title: Output not displaying zeros in the beginning of binary conversions
body: <p>I tried searching for answers to this specific question, I could see formatting options and how to pad zeros to the left but my output cannot have decimal space designated zeros but only the zeros from the conversion result. For example if I convert 45 to binary it should display 00101101 but it omits the first two zeros, obviously, and displays 101101. If I format the output it displays extra or less zeros based on the format specifications. I am a beginner and not very good at JAVA. All help is appreciated. Here is the part of code specific to my question:</p>
  
  <pre><code>public class DecimalToBinary {
  public String toBinary(int b) {
      if (b==0) {
          return "0";
          }
          String binary = "";
          while (b &gt; 0 &amp;&amp; b &lt; 256) {
              int rem = b % 2;
              binary = rem + binary;
              b = b / 2;
          }
      return binary;
  }
  </code></pre>
  
  <p>//MAIN:</p>
  
  <pre><code>public static void main(String[] args) {
      int Choice;
      Scanner input = new Scanner(System.in);
      DecimalToBinary convertD2B = new DecimalToBinary();
      BinaryToDecimal convertB2D = new BinaryToDecimal();
      do{
      System.out.println("Hello! What would you like to do today? Please enter 1, 2, or 3 based on the following: "+"\n"+
      "1. Convert Decimal to Binary"+"\n"+"2. Convert Binary to Decimal"+"\n"+"3. Exit");
      Choice = input.nextInt();
      if(Choice==1){
          System.out.println("Enter a Decimal Number between 0 to 255: ");
          int decimalNumber = input.nextInt();
          if(decimalNumber&lt;256)
              {String output = convertD2B.toBinary(decimalNumber);
              System.out.println("The Binary equivalent of "+decimalNumber+" is: "+output);
              }
          else
              {System.out.println("Please start over and enter a number between 0 and 255.");}
      }
  </code></pre>