title: Does this java homework involve boolean? How to implement the loop?
body: <p>I am almost a complete beginner.</p>
  
  <p>I need to write a program that asks user to input a binary number, verifies whether the number is in fact binary, and then count the number of 1's in the binary number.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>import java.util.Scanner;
  import java.text.DecimalFormat;
  
  public class BinaryWords 
  {
      public static void main( String [] args )
      {
      int binaryNumber1;
      int binaryNumber2;
      int binaryNumber3;
      int binaryNumber4;
      int binaryNumber5;
      int binaryNumber6;
      int binaryNumber7;
      int binaryNumber8;
      int binaryNumber9;
      int binaryNumber10;
      int binaryNumberWhole = binaryNumber1 + binaryNumber2 + binaryNumber3
              + binaryNumber4 + binaryNumber5 + binaryNumber6 + binaryNumber7
              + binaryNumber8 + binaryNumber9 + binaryNumber10;
  
      if 1&lt;binaryNumber1&lt;0
  
          then final int SENTINEL = binaryNumber1;
  
  
      System.out.println( "This program verifies a binary number"
              + "representing a word and then" 
              + "counts how many 1's are in that number");
  
      System.out.println("Please enter a binary number representing a word");
  </code></pre>
  
  <p>Not pretty, I know!  I am confused as to how to read each binary number in the binary sequence and check for 0 or 1. </p>
  
  <p>Any help would be greatly appreciated!</p>