title: Java instanceof and byte[]
body: <p>What I would expect is that '<code>potentialByteArray instanceof byte[]</code> would return true when <code>potentialByteArray</code> is an instance of a <code>byte[]</code>, but this doesn't seem to happen -- it's always false for some reason! </p>
  
  <p>I've got a conditional that looks like the following:</p>
  
  <pre><code>if (!(potentialByteArray instanceof byte[])) { /* ... process ... */ }
  else  {
          log.warn("--- can only encode 'byte[]' message data (got {})", msg.getClass().getSimpleName());
          /* ... handle error gracefully ... */
      }
  </code></pre>
  
  <p>...and what this outputs is the following:</p>
  
  <pre><code>--- can only encode 'byte[]' message data (got byte[])
  </code></pre>
  
  <p>Which means that the object actually <em>was</em> a <code>byte[]</code> but wasn't an <code>instanceof byte[]</code> somehow. So... would this work for <code>Byte[]</code> instead or something? What's really going on here, and why isn't this working as I am expecting? </p>
  
  <p>What's an appropriate idiom to use here instead?</p>