title: How to convert a binary image data to a jpg file in Java where every 10bits in the binary data represent a pixel?
body: <p>I am receiving a stream of bits over the <code>Ethernet</code>. I am collecting the bits in a <code>byte[]</code> array in <code>Java</code>(I am collecting them in a byte[] because I think its relevant).The stream is a digitized image where every 10 bits represent a pixel. There are <code>1280*1024</code> pixels. Every pixel is represented by 10 bits. Hence,<code>1280*1024*10 = 13107200 bits = 1638400 bytes</code> is the image size. </p>