title: BufferedImage - Gray Scale
body: <p>Given an image that is in <strong>grayscale</strong>, how would I get the pixel values of the grayscale at that location? </p>
  
  <p>This outputs temp as <code>-16777216</code> (black) all the time.</p>
  
  <pre><code>public void testMethod()
  {
      int width = imgMazeImage.getWidth();
      int height = imgMazeImage.getHeight();
  
      //Assign class variable as a new image with RGB formatting
      imgMazeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
      for(int i=0; i &lt; width; i ++){
          for(int j=0; j &lt; height; j++)
          {
              //Grab and set the colors one-by-one
              inttemp = imgMazeImage.getRGB(j, i);
              System.out.println(temp);
          }
      }
  }
  </code></pre>