Binary representation of a given number | Java implementation of the approach ; Function to convert decimal to binary number ; Driver code
class GFG { static void bin ( Integer n ) { if ( n > 1 ) bin ( n >> 1 ) ; System . out . printf ( " % d " , n & 1 ) ; } public static void main ( String [ ] args ) { bin ( 131 ) ; System . out . printf ( "NEW_LINE"); bin ( 3 ) ; } }