title: Conversion from Base 10 to Base 2
body: <p>I am trying to convert a number in base 10 to a number in base 2, but I have a problem. When I run the code, I get the base 2 number in the wrong order. For example, I input 54 and get 110110 instead of 011011, the correct value. </p>
  
  <pre><code>import java.util.Scanner; 
  public class DecimalToBinary
  {
  public static void main(String arg[]){   
    int quotient;
    int remainder;
  
    Scanner keyboard = new Scanner (System.in);
    System.out.println("Please enter a decimal number:"); 
    quotient = keyboard.nextInt();  
  
    do {
       remainder = quotient % 2;
       quotient = quotient / 2;
  
      // String x = String.valueOf(remainder);
      // System.out.print(x);
    System.out.print (remainder);
  
    } while (quotient != 0);
     }  
     }
  </code></pre>