title: how to get RGB values from byte[] array in android camera2 when ImageFormat is JPEG?
body: <p>I'm using camera2 API I'm interested in getting RGB value from byte array actually average of RGB values can I get it from this part when byte array is collected from ByteBuffer and gets written in file with FileOutputStream.write(bytes) </p>
  
  <p><strong>Here is my code:</strong> </p>
  
  <pre>
  <code>ByteBuffer byteBuffer = mImage.getPlanes()[0].getBuffer();
  byte[] bytes = new byte[byteBuffer.remaining()]; 
  byteBuffer.get(bytes); 
  FileOutputStream fileOutputStream = null; 
  try {  
       fileOutputStream = new FileOutputStream(mImageFile);    
       fileOutputStream.write(bytes); 
  } 
  catch (FileNotFoundException e) {  
     // TODO Auto-generated catch block  e.printStackTrace(); } catch    
     (IOException e) {  
            // TODO Auto-generated catch block  e.printStackTrace(); 
     } 
  finally {  
      mImage.close();  
      try {   
         fileOutputStream.close();  
      } 
      catch (IOException e) {   // TODO Auto-generated catch block  
          e.printStackTrace();  
      } 
  } </code></pre>