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

Why Mark Zuckerberg’s Choose 4

Error message when I run sudo: unable to resolve host (none)

Convert MBR to GPT