‘Integer.toBinaryString’
method is used to convert integer to binary string.
Example
int i =
1027;
String
binaryString = Integer.toBinaryString(i);
package com.sample.app;
public class App {
public static void main(String args[]) {
int i = 1027;
String binaryString = Integer.toBinaryString(i);
System.out.println("Binary form of " + i + " is " + binaryString);
}
}
Output
Binary
form of 1027 is 10000000011
You may
like
No comments:
Post a Comment