@Test public void success_ReverseByteArrayToBigInteger() { byte[] input = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; byte[] input2 = new byte[]{31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}; BigInteger integer1 = new BigInteger(input); BigInteger integer2 = new BigInteger(ByteUtils.reverse(input2)); assertEquals(integer1, integer2); }
public static byte[] reverse(byte[] input) { byte[] output = new byte[input.length]; int counter = 0; for (byte b : input) { output[input.length - counter - 1] = b; counter++; } return output; }
ByteUtils { public static byte[] reverse(byte[] input) { byte[] output = new byte[input.length]; int counter = 0; for (byte b : input) { output[input.length - counter - 1] = b; counter++; } return output; } }
ByteUtils { public static byte[] reverse(byte[] input) { byte[] output = new byte[input.length]; int counter = 0; for (byte b : input) { output[input.length - counter - 1] = b; counter++; } return output; }  }
ByteUtils { public static byte[] reverse(byte[] input) { byte[] output = new byte[input.length]; int counter = 0; for (byte b : input) { output[input.length - counter - 1] = b; counter++; } return output; }  static byte[][] split(byte[] input, int firstLength); static byte[] reverse(byte[] input); static byte[] join(byte[] value1, byte[] value2); static byte[] join(byte[]... inputs); static byte[] paddingZeroOnHead(byte[] input, int byteLength); static byte[] paddingZeroOnTail(byte[] input, int byteLength); static int readBit(byte value, int position); }
ByteUtils { public static byte[] reverse(byte[] input) { byte[] output = new byte[input.length]; int counter = 0; for (byte b : input) { output[input.length - counter - 1] = b; counter++; } return output; }  static byte[][] split(byte[] input, int firstLength); static byte[] reverse(byte[] input); static byte[] join(byte[] value1, byte[] value2); static byte[] join(byte[]... inputs); static byte[] paddingZeroOnHead(byte[] input, int byteLength); static byte[] paddingZeroOnTail(byte[] input, int byteLength); static int readBit(byte value, int position);  }