Read .bmp image and subtract 10 from 10th byte of the image and re-create the image in Java
<p>I am creating an application which will read image byte/pixel/data from an .bmp image and store it in an byte/char/int/etc array.</p>

<p>Now, from this array, I want to subtract 10 (in decimal) from the data stored in the 10th index of an array.</p>

<p>I am able to successfully store the image information in the array created. But when I try to write the array information back to .bmp image, the image created is not viewable.</p>

<p>This is the piece of code which I tried to do so.</p>

<p>In this code, I am not subtracting 10 from the 10th index of an array.</p>

<p>public class Test1 {</p>

<pre><code>public static void main(String[] args) throws IOException{
    File inputFile = new File("d://test.bmp");
    FileReader inputStream = new FileReader("d://test.bmp");
    FileOutputStream outputStream = new FileOutputStream("d://test1.bmp");

    /*
     * Create byte array large enough to hold the content of the file.
     * Use File.length to determine size of the file in bytes.
     */
    byte fileContent[] = new byte[(int)inputFile.length()];


    for(int i = 0; i &lt; (int)inputFile.length(); i++){
        fileContent[i] = (byte) inputStream.read();
    }

    for(int i = 0; i &lt; (int)inputFile.length(); i++){
        outputStream.write(fileContent[i]);
    }

    outputStream.flush();
    outputStream.close();
}
</code></pre>

<p>}</p>
