Monday, February 23, 2015

Integer To Binary java



IntegerToBinary.java

public class IntegerToBinary
{
 public static void convert(int n)
   {
      if (n == 0) return;
      convert(n / 2);
      System.out.println(n % 2);
   }

   public static void main(String[] args)
   {
      int N = Integer.parseInt(args[0]);
      convert(N);
      System.out.println();
   }
            }
 

No comments:

Post a Comment