0

I am trying to convert string of 0 and 1 to byte[] to save this in file, and in next step read this from the file and convert to string of 0 and 1. I don't know how to write toByteArray(String input)

Something like this:

String input = "011100101110001101000";
byte[] array = toByteArray(input);//how to do it
String output = "";

for(byte b : array) 
    outputString += Integer.toBinaryString(b);

System.out.println(output);// 011100101110001101000
khelwood
  • 55,782
  • 14
  • 81
  • 108
M.Devan
  • 169
  • 2
  • 13

0 Answers0