title: How to Draw a simple GUI Histogram
body: <p>I need to draw a simple histogram for a project I'm working on that needs to look this...</p>
  
  <p><img src="https://i.stack.imgur.com/5JETT.png" alt="Histogram"></p>
  
  <p>I know there is got to be some simple for loop to run on my H[] array which consists of how many pixels belong to each gray scale value... so in H[] we have lets say "10 pixels in gray scale value 1" so at 1 there would be a line of length 10 going vertically next to my image...</p>
  
  <p>if anyone could offer their help, I would greatly appreciate it!</p>
  
  <p>Thanks.</p>
  
  <p>wrote this but its too big and upside down and angled for some reason.</p>
  
  <pre><code>         if (H != null) {
                      int width = getWidth();
                      int height = getHeight();           
                      int HhPos = (width - (width/2));
                      int HvPos = (height - (height));
                    for(int i = 0 ; i &lt;255 ; i++){
                       g.drawRect(i+HhPos, i+HvPos, 1, H[i]);
  
  
                     }
  </code></pre>