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
  • 52,115
  • 13
  • 74
  • 94
M.Devan
  • 149
  • 1
  • 11

0 Answers0