title: Convert Byte[] to int
body: <p>I have this method that converts a signed or non-signed <code>byte</code> to <code>int</code>, but it doesn't return what it is supposed to return. Can someone point out the issue in the below code?</p>
  
  <pre><code>public int convertByteToInt(byte[] b){          
      int value= 0;
      for(int i=0;i&lt;b.length;i++){                
      int n=(b[i]&lt;0?(int)b[i]+256:(int)b[i])&lt;&lt;(8*i);             
          value+=n;
      }         
      return value;       
  }
  </code></pre>
  
  <p>Edited :</p>
  
  <p>I'am actualy reading a wav file in order to calculate the SNR. the returned value from the conversion should give something beetween 0 and 255.
  The application should compare 2 waves file, on is the orignal one and the other is modified and calculate the SNR .</p>