List of utility methods to do Binary to Char
String | BinaryToAscii(String binary) Binary To Ascii String output = ""; for (int i = 0; i <= binary.length() - 8; i += 8) { int k = Integer.parseInt(binary.substring(i, i + 8), 2); output += (char) k; return output.toLowerCase().trim(); |
char[] | binaryToChar(char[] binaryStr, int charLen) binary To Char int len = binaryStr.length; int num = 0; if (len % charLen == 0) num = len / charLen; else num = len / charLen + 1; char[] values = new char[num]; int end = len - 1; ... |
char | binaryToCharacter(String s) Translates a byte (representing one character) to its character representation. char[] binaryCharacter = s.toCharArray(); int decimalValueOfCharacter = 0; for (int i = 0; i < LENGTH_OF_BINARY_UNIT; i++) { double bitPositionValue = Math.pow(BASE_OF_BINARY_UNIT, (MAX_EXPONENT_IN_BINARY_UNIT - i)); decimalValueOfCharacter += (binaryCharacter[i] - '0') * Math.round(bitPositionValue); return (char) decimalValueOfCharacter; |