62,636
社区成员




public class Test {
public static void main(String[] args) {
int k = 112;
byte[] b = toBytes(k);
System.out.println(toInt(b));
}
private static byte[] toBytes(int num) {
byte[] bytes = new byte[2];
bytes[0] = (byte)((num & 0xff00) >> 8);
bytes[1] = (byte)(num & 0xff);
return bytes;
}
private static int toInt(byte[] bytes) {
return (bytes[0] << 8) | bytes[1];
}
}