How to convert integer to binary in Java

1 Answer

0 votes
public class MyClass {
    public static void main(String args[]) {
        int n = 14;
  
        System.out.println(Integer.toBinaryString(n));
    }
}
 
 
 
/*
run:
 
1110
 
*/

 



answered Jul 23, 2020 by avibootz

Related questions

1 answer 218 views
2 answers 174 views
1 answer 160 views
1 answer 92 views
1 answer 100 views
100 views asked Nov 17, 2024 by avibootz
1 answer 120 views
...