Here you can find the source of toChar(String string)
public static char toChar(String string)
//package com.java2s; //License from project: Open Source License public class Main { public static char toChar(String string) { return (char) toInt(string); }/* w w w. j a va 2 s . com*/ public static int toInt(String value) { if (!isBinary(value)) return 0; if (value.length() > 31) return Integer.MAX_VALUE; return Integer.parseInt(value, 2); } public static boolean isBinary(String binary) { if (binary == null || binary.length() == 0) return false; for (char c : binary.toCharArray()) if (!(c == '0' || c == '1')) return false; return true; } }