title: java byte vs c++ BYTE
body: <p>I know Java <code>byte</code> range is -128 to 127, but C++ <code>BYTE</code> is a <code>unsigned char</code> (0 to 255.) </p>
  
  <p>I want to convert a C++ function to Java, and in C++ I have a <code>LPBYTE</code> (which is a pointer to <code>BYTE</code> array.) I've tried using <code>byte</code> array instead of <code>LPBYTE</code> in C++ function, but my Java function is still not working correctly.</p>
  
  <p>My C++ function works on a BMP file and it's algorithm is customized run length encoding. In converting it to Java I'm using a <code>BufferedImage</code> and getting its content as <code>byte[]</code>. I'm guessing the Java function is not working correctly because of type mismatch. </p>
  
  <p>Which type should I use in Java?</p>