Created
April 24, 2012 17:19
-
-
Save chrishuan9/2481663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getHexString(byte[] b) throws Exception { | |
String result = ""; | |
for (int i=0; i < b.length; i++) { | |
result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 ); | |
} | |
return result; | |
} | |
public static byte[] getByteArray(String hexString) { | |
return BigInteger(hexString,16).toByteArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment