I want to convert every character of a String to a new binary String. Here is what I do :
public static void main(String args[]) {
    String MESSAGE = "%";
    String binaryResult = "";
    for (char c : MESSAGE.toCharArray()){
        binaryResult += Integer.toBinaryString( (int) c);
    }
    System.err.println(binaryResult);
}
For exemple with the input : "%", I get the following output : "100101" My problem is that the leading "0" is deleted ... I want to have : "0100101". Does anyone have ideas?
 
     
     
    