@Test public void testIntsToByte() throws UnsupportedEncodingException { int[] arr = new int[]{0xE4, 0xb8, 0xAD, 0xE6, 0x96, 0x87}; byte[] bt = ConvertUtil.intToByte(arr); String str = new String(bt); System.out.println(str); int[] tt = new int[]{0xD6, 0xD0, 0xCE, 0xC4}; String strs = new String(ConvertUtil.intToByte(tt), "GBK"); System.out.println(strs); }
public final static byte[] intToByte(int i) { byte[] bt = new byte[4]; bt[0] = (byte) (0xff & i); bt[1] = (byte) ((0xff00 & i) >> 8); bt[2] = (byte) ((0xff0000 & i) >> 16); bt[3] = (byte) ((0xff000000 & i) >> 24); return bt; }
ConvertUtil { public final static byte[] intToByte(int i) { byte[] bt = new byte[4]; bt[0] = (byte) (0xff & i); bt[1] = (byte) ((0xff00 & i) >> 8); bt[2] = (byte) ((0xff0000 & i) >> 16); bt[3] = (byte) ((0xff000000 & i) >> 24); return bt; } }
ConvertUtil { public final static byte[] intToByte(int i) { byte[] bt = new byte[4]; bt[0] = (byte) (0xff & i); bt[1] = (byte) ((0xff00 & i) >> 8); bt[2] = (byte) ((0xff0000 & i) >> 16); bt[3] = (byte) ((0xff000000 & i) >> 24); return bt; }  }
ConvertUtil { public final static byte[] intToByte(int i) { byte[] bt = new byte[4]; bt[0] = (byte) (0xff & i); bt[1] = (byte) ((0xff00 & i) >> 8); bt[2] = (byte) ((0xff0000 & i) >> 16); bt[3] = (byte) ((0xff000000 & i) >> 24); return bt; }  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[] intToByte(int i) { byte[] bt = new byte[4]; bt[0] = (byte) (0xff & i); bt[1] = (byte) ((0xff00 & i) >> 8); bt[2] = (byte) ((0xff0000 & i) >> 16); bt[3] = (byte) ((0xff000000 & i) >> 24); return bt; }  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);  }