@Test public void testBeBigEndian() { String[][] example = new String[][] { new String[] { "1020", "2010" }, new String[] { "102030", "302010" }, new String[] { "10", "10" } }; for (String[] test : example) { assertEquals(test[0], NumericUtil.beBigEndianHex(test[1])); } }
public static String beBigEndianHex(String hex) { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return hex; } return reverseHex(hex); }
NumericUtil { public static String beBigEndianHex(String hex) { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return hex; } return reverseHex(hex); } }
NumericUtil { public static String beBigEndianHex(String hex) { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return hex; } return reverseHex(hex); }  }
NumericUtil { public static String beBigEndianHex(String hex) { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return hex; } return reverseHex(hex); }  static byte[] generateRandomBytes(int size); static boolean isValidHex(String value); static String cleanHexPrefix(String input); static String prependHexPrefix(String input); static BigInteger bytesToBigInteger(byte[] value, int offset, int length); static BigInteger bytesToBigInteger(byte[] value); static BigInteger hexToBigInteger(String hexValue); static String bigIntegerToHex(BigInteger value); static String bigIntegerToHexWithZeroPadded(BigInteger value, int size); static byte[] bigIntegerToBytesWithZeroPadded(BigInteger value, int length); static byte[] hexToBytes(String input); static byte[] hexToBytesLittleEndian(String input); static byte[] reverseBytes(byte[] bytes); static String bytesToHex(byte[] input); static String beBigEndianHex(String hex); static String beLittleEndianHex(String hex); static int bytesToInt(byte[] bytes); static byte[] intToBytes(int intValue); }
NumericUtil { public static String beBigEndianHex(String hex) { if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) { return hex; } return reverseHex(hex); }  static byte[] generateRandomBytes(int size); static boolean isValidHex(String value); static String cleanHexPrefix(String input); static String prependHexPrefix(String input); static BigInteger bytesToBigInteger(byte[] value, int offset, int length); static BigInteger bytesToBigInteger(byte[] value); static BigInteger hexToBigInteger(String hexValue); static String bigIntegerToHex(BigInteger value); static String bigIntegerToHexWithZeroPadded(BigInteger value, int size); static byte[] bigIntegerToBytesWithZeroPadded(BigInteger value, int length); static byte[] hexToBytes(String input); static byte[] hexToBytesLittleEndian(String input); static byte[] reverseBytes(byte[] bytes); static String bytesToHex(byte[] input); static String beBigEndianHex(String hex); static String beLittleEndianHex(String hex); static int bytesToInt(byte[] bytes); static byte[] intToBytes(int intValue);  }