List of utility methods to do Binary to Hex
String | binToHex(String bin) bin To Hex String result = ""; int decimal; for (int i = 4; (i <= 64 && i <= bin.length()); i = i + 4) { decimal = Integer.parseInt(bin.substring((i - 4), i), 2); result = result.concat(Integer.toString(decimal, 16)).toUpperCase(); return result; |
String | binToHex(String sBinString) bin To Hex String sHexString = ""; String sTemp = ""; while (sBinString.length() >= 4) { sTemp = sBinString.substring(0, 4); sBinString = sBinString.substring(4, sBinString.length()); sHexString += Integer.toHexString(Integer.parseInt(sTemp, 2)); if (sBinString.length() > 1) { ... |
String | binToHexString(byte[] bytes) bin To Hex String return new String(binToHex(bytes)); |