update 电单车

This commit is contained in:
Guoqs
2024-09-13 09:33:23 +08:00
parent e154b0c0dc
commit decd185c79
3 changed files with 21 additions and 4 deletions

View File

@@ -133,4 +133,18 @@ public class YouDianUtils {
// 转换为字节数组
return BytesUtil.intToBytesLittle(hexValue, 1);
}
/**
* 端口号从0开始
* @param portNumber
* @return
*/
public static String convertPortNumberToString(int portNumber) {
if (portNumber < 0 || portNumber > 15) {
throw new IllegalArgumentException("Port number must be between 0 and 15.");
}
// 转换为字节数组
return String.format("%02d", portNumber + 1);
}
}