Convert Binary TO String Using JAVA.........


Hi Friends This Program Will Demonstrate the Logic of Binary TO String Conversion....



Save The File BinarytoStr.java



import java.math.BigInteger;

class BinarytoStr

{

public static void main(String[] args)

{

String z = "0100100001100101011011000110110001101111";

int len = z.length()/8;

String orgstring = "";

byte[] bval = new BigInteger(z, 2).toByteArray();

for(int t = 0;t<len;t++)

{

char c1 = (char)bval[t];

orgstring = orgstring.concat(String.valueOf(c1));

}

System.out.println("Original String : " + orgstring);

}

}



OUTPUT : 



Original String : Hello







I hope this logic will helpful to all...........

Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.