The ultimate Question

I had a string for eg “java education” which I have converted into bits. Now I have an array of bits. I want to convert it back into text. How to do this?

String s="Java Education";
char[] ch=s.toCharArray();
String g="  ";
StringBuilder sb=newStringBuilder();
for(char c:ch){
char[] ch2= sb.toString.toCharArray();

I want to get back the text from the array ch2.


String s="Java Education";char[] ch=s.toCharArray();String g="";StringBuilder sb=newStringBuilder();for(char c:ch){
        g=Integer.toBinaryString((int)c);if(g.length()<8){for(int h=0; h<8-g.length(); h++){
        sb.append(',');}char[] ch2= sb.toString().toCharArray();String[] s3 =newString(ch2).split(",");for(String t: s3){String d="";for(int x=t.length()-1; x>=0; x--) d+=t.charAt(x);
        t=d;int num=0;for(int j=0; j<t.length(); j++){
            num+=Integer.parseInt(""+t.charAt(j))*Math.pow(2, j);}System.out.print((char)num);}

Constructive and genuine appreciation and/or criticism most welcome

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s