📄 addressparser.java
字号:
package com.ict.netcom2.parser;
import com.ict.netcom2.util.*;
public class AddressParser {
public static byte[] macAddr2bytes(String macAddr) {
byte[] ret = new byte[6];
// macAddr = "0:1:2:3:4:5"
int index;
String str;
for (int i=0; i<6; i++) {
index = macAddr.indexOf(":");
if (index == -1) {
str = macAddr;
}
else {
str = macAddr.substring(0, index);
macAddr = macAddr.substring(index+1);
}
ret[i] = Byte.valueOf(str);
}
return ret;
}
public static void main(String[] args) {
String str = "0:1:2:3:4:5";
byte[] b = macAddr2bytes(str);
Shower.showInVal(b);
System.out.println(str);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -