Integer Wrapper class have a static method toBinaryString() which converts the given Integer to the Binary String.
Let us go through a small program which can demonstrate to us the same part.
class IntToBinary { public static void main(String[] args) { int i=25; String binaryString=Integer.toBinaryString(i); System.out.println(i+" in binary is "+binaryString); } }
Here the number 25 is converted to Binary String 11001
0 comments:
Post a Comment