title: I get : cannot invoke length() on the primitive type int
body: <p>We have to make a program that converts Binary numbers into Decimal numbers using a GUI. First I made the program without using a GUI and it was working fine. Then I tried with the GUI and while making the program I keep getting an error message saying "cannot invoke length() on the primitive type int"</p>
  
  <pre><code>    int BinaryNumber, DecimalNumber;
              try {
                  BinaryNumber = Integer.parseInt(textFieldtUserBinaryInput.getText());
  
                  DecimalNumber = 0;
                      for (int i = 0; i &lt; BinaryNumber.length(); i++);
                      {
                          Character binary = BinaryNumber.charAt(i);
                          String temp = binary.toString();
                          int tempInt = Integer.parseInt(temp);
                          DecimalNumber = DecimalNumber * 2 + tempInt;
                          textFieldDecimal.setText(Integer.toString(DecimalNumber));
                      }
  
  
  
  
              }catch (NumberFormatException exp){
  
                  JOptionPane.showMessageDialog(null, "Invalid format for a binary string - Illegal character");
              }
          }
  </code></pre>
  
  <p>Any input is greatly appreciated. Thanks!</p>
  
  <p>this is what I had when it was working without trying to do the GUI </p>
  
  <pre><code>    public static int ConvertToDecimal(String BinaryNumber)
  {
      String pattern = "[0-1]*";
      boolean patternMatched = Pattern.matches(pattern, BinaryNumber);  
      if(patternMatched)
      {
          int Decimal = 0;
          for (int d = 0; d &lt; BinaryNumber.length(); d++)
          {
              Character binary = BinaryNumber.charAt(d);
              String temp = binary.toString();
              int tempInt = Integer.parseInt(temp);
              Decimal = Decimal * 2 + tempInt;
          }
          return Decimal;
      }
  </code></pre>