title: Bitwise AND with non-booleans
body: <p>In the following Java program I cannot understand what this line does:</p>
  
  <pre><code>wert = (wert * mult + inkr) &amp; 0x7FFFFFFFL;
  </code></pre>
  
  <p>I understand what the bitwise operators do in conditions, but there are principally two numbers (the hexadecimal is the maximum value of Integers in Java). I do not understand, why the <em>&amp; 0x7FFFFFFFL;</em> has even some influence in this line. In my opinion, the variable <em>wert</em> should simply have the value of <strong>(wert * mult + inkr)</strong> because it's true.
  Though I figured out that the <em>&amp; 0x7FFFFFFFL;</em> obviously does have some influence only if <strong>(wert * mult + inkr)</strong> is negative. Why and what exactly happens in this line?</p>
  
  <p>Annotation: This should be a program for simulating a lottery drawing. I am aware of the error in the program, right where the comment is. But this is not relevant for me right now.
  Still it would be great if someone could me tell following not really Java-specific question: what sense got the variables <em>mult</em> and <em>inkr</em>?</p>
  
  <pre><code>public static void main(String args[]) {
      int kugeln = 49;
      int ziehen = 6;
      int mult = 1103515245;
      int inkr = 12345;
      long wert = System.currentTimeMillis();
      int zahlen[] = new int[kugeln];
  
      for(int i = 0; i &lt; kugeln; i++) {
          zahlen[i] = i + 1;
          wert = (wert * mult + inkr) &amp; 0x7FFFFFFFL;
      }
  
      for(int i = 0; i &lt; ziehen; i++) {
          int index = (int)(wert / 10) % (49 - i);
          int temp = zahlen[49 - i]; // Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 49
          zahlen[49 - i] = zahlen[index];
          zahlen[index] = temp;
          wert = (wert * mult + inkr) &amp; 0x7FFFFFFFL;
      }
  
      int superzahl = (int)(wert / 10) % 10;
      for(int i = 0; i &lt; ziehen; i++) {
          System.out.println(zahlen[49 - i]);
      }
  
      System.out.println(superzahl);
  }
  </code></pre>