title: Fixed Point Numbers
body: <p>I am stuck on a project in my intro to Java class.</p>
  
  <p>We have to create a code that will convert a number to a Fixed Point Number. I've got that part okay, but where I am stuck is in the mathematics portion of our assignment. We have to add, subtract, multiple w/ (scalar (float) method, and divide with scalar (float) method.</p>
  
  <p>Here is the code I have so far. If anyone could help point me in the right direction to getting a second number output and having the two numbers add, I would appreciate it.</p>
  
  <pre><code>public class FixedNumber {
  public static final int lastSix = Integer.parseInt("111111", 2);
  int value;
  int value2;
  
  public FixedNumber(int value) {
      this.value = value &lt;&lt; 6;
  }
  public FixedNumber(int integral, float decimal) {
      this.value = (integral &lt;&lt; 6) + (int)(decimal % 1 * 50);
  }
  public FixedNumber(float value) {
      this.value = ((int)value &lt;&lt; 6) + (int)(value % 1 * 50);
  }
  public String toString() {
      return (value &gt;&gt; 6) + "." + ((value &amp; lastSix) * 2);
      //return "" + ((value &lt;&lt; 26) &gt;&gt;&gt; 26);
  }
  public static void main(String[] args) {
      FixedNumber number = new FixedNumber(12786783, 0.87654f); //integral, decimal
      FixedNumber number2 = new FixedNumber(3.876545f); //value
      System.out.println(number);
      System.out.println(number2);
  }
  }
  </code></pre>