- 2

Decimal to binary conversion in java??😐

27th Oct 2020, 1:48 PM
Abhishek Sahu
Abhishek Sahu - avatar
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
27th Oct 2020, 1:54 PM
Matias
Matias - avatar
+ 2
Thank you all😊
27th Oct 2020, 5:24 PM
Abhishek Sahu
Abhishek Sahu - avatar
+ 1
Integer.toBinaryString(int yourdecimal) Returns in string
27th Oct 2020, 1:55 PM
Yarek Kochanowski
Yarek Kochanowski - avatar