title: What does the ^ operator do in Java?
body: <p>What function does the <code>^</code> (caret) operator serve in Java?</p>
  
  <p>When I try this:</p>
  
  <pre><code>int a = 5^n;
  </code></pre>
  
  <p>...it gives me:</p>
  
  <blockquote>
    <p>for n = 5, returns 0<br>
    for n = 4, returns 1<br>
    for n = 6, returns 3  </p>
  </blockquote>
  
  <p>...so I guess it doesn't perform exponentiation. But what is it then?</p>