- 2
Decimal to binary conversion in java??😐
3 Réponses
+ 4
Java Convert Decimal to Binary
We can convert decimal to binary in java using Integer.toBinaryString() method or custom logic.
Java Decimal to Binary conversion: Integer.toBinaryString()
The Integer.toBinaryString() method converts decimal to binary string. The signature of toBinaryString() method is given below:
public static String toBinaryString(int decimal)
Let's see the simple example of converting decimal to binary in java.
public class DecimalToBinaryExample1{
public static void main(String args[]){
System.out.println(Integer.toBinaryString(10));
System.out.println(Integer.toBinaryString(21));
System.out.println(Integer.toBinaryString(31));
}}
For more see this https://www.javatpoint.com/java-decimal-to-binary
+ 2
Thank you all😊
+ 1
Integer.toBinaryString(int yourdecimal)
Returns in string