@Test public void testshortToByte() { byte[] bt = ConvertUtil.shortToByte((short) 1); System.out.println(Arrays.toString(bt)); System.out.println(ConvertUtil.byteToBinary(bt[0])); System.out.println(ConvertUtil.byteToBinary(bt[1])); }
public final static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = 0; i < b.length; i++) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8; } return b; }
ConvertUtil { public final static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = 0; i < b.length; i++) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8; } return b; } }
ConvertUtil { public final static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = 0; i < b.length; i++) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8; } return b; }  }
ConvertUtil { public final static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = 0; i < b.length; i++) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8; } return b; }  final static byte[] shortToByte(short number); final static short byteToShort(byte[] b); final static byte[] intToByte(int i); final static byte[] intToByte(int[] arr); final static byte[] encodeBytes(byte[] source, char split); final static char[] bytesToChars(byte[] bytes); final static int bytesToInt(byte[] bytes); final static byte[] longToByte(long number); final static long byteToLong(byte[] b); final static String byteToBinary(byte src); final static String hexStringtoBinarg(String hexStr); final static String bytesToHexString(byte[] bytes); final static byte[] hexStringToByte(String hexString); }
ConvertUtil { public final static byte[] shortToByte(short number) { int temp = number; byte[] b = new byte[2]; for (int i = 0; i < b.length; i++) { b[i] = new Integer(temp & 0xff).byteValue(); temp = temp >> 8; } return b; }  final static byte[] shortToByte(short number); final static short byteToShort(byte[] b); final static byte[] intToByte(int i); final static byte[] intToByte(int[] arr); final static byte[] encodeBytes(byte[] source, char split); final static char[] bytesToChars(byte[] bytes); final static int bytesToInt(byte[] bytes); final static byte[] longToByte(long number); final static long byteToLong(byte[] b); final static String byteToBinary(byte src); final static String hexStringtoBinarg(String hexStr); final static String bytesToHexString(byte[] bytes); final static byte[] hexStringToByte(String hexString);  }