title: Converting Decimal to Binary Java
body: <p>I am trying to convert decimal to binary numbers from the user's input using Java. </p>
  
  <p>I'm getting errors.</p>
  
  <pre><code>package reversedBinary;
  import java.util.Scanner;
  
  public class ReversedBinary {
  
  
  public static void main(String[] args) {
      int number; 
  
      Scanner in = new Scanner(System.in);
  
      System.out.println("Enter a positive integer");
      number=in.nextInt();
  
      if (number &lt;0)
          System.out.println("Error: Not a positive integer");
      else { 
  
          System.out.print("Convert to binary is:");
          System.out.print(binaryform(number));
  }
  
  }
  
  private static Object binaryform(int number) {
      int remainder;
  
      if (number &lt;=1) {
          System.out.print(number);
  
      }
  
      remainder= number %2; 
      binaryform(number &gt;&gt;1);
      System.out.print(remainder);
  
      { 
      return null;
  } } }
  </code></pre>
  
  <p>How do I convert Decimal to Binary in Java?</p>