title: The value retrieved has a null value. How to eliminate them?
body: <p>I already succeed in retrieving the RGB pixel value from compareHexaRGB method. And the output doesn't seem convincing as the output includes with a null character too. How can I eliminate them? </p>
  
  <p>Second, when I tried to combine String[][] char 1 + char 2 I get an error stated that it is bad operand for type "+". But I would like to combine the 2 string in order for me to be able to convert it to ASCII character. </p>
  
  <p>Here is the code for compareHexaRGB method:</p>
  
  <pre><code>public class compareHexaRGB
  {
   private static int w;
   private static int h;
   private static BufferedImage img;
   private static BufferedImage img2;
   private static String[][] check_hex2;
   private static String[][] check_hex4;
   private static String[][] message;
  
   public static void compareHexaRGB(BufferedImage image, BufferedImage image2, int width, int height) throws IOException
  {
  w = width;
  h = height;
  img = image;
  img2 = image2;
  
  }
  
  public void check() throws IOException
  {
      getPixelRGB1 pixel = new getPixelRGB1();
      getPixelData1 newPD = new getPixelData1();
  
      int[] rgb;
      int count = 0;
  
      int[][] pixelData = new int[w * h][3];
      check_hex2 = new String[w][h];
      check_hex4 = new String[w][h];
  
      for(int i = 0; i &lt; w; i++) 
      {
          for(int j = 0; j &lt; h; j++)
          {
              rgb = newPD.getPixelData(img, i, j);
  
              for(int k = 0; k &lt; rgb.length; k++)
              {
                  pixelData[count][k] = rgb[k];
              }
  
                  if(pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j]))
                  {
                      System.out.println("\nPixel values at position 2 are the same." + "\n" + pixel.display_imgHex2()[i][j] + "  " + pixel.display_img2Hex2()[i][j]);
                  }
                  if(pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j]))
                  {
                      System.out.println("\nPixel values at position 4 are the same." + "\n" + pixel.display_imgHex4()[i][j] + "  " + pixel.display_img2Hex4()[i][j]);
                  }
                  if(!pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j]))
                  {
                      System.out.println("\nPixel values at position 2 are not the same." + "\n" + pixel.display_imgHex2()[i][j] + "  " + pixel.display_img2Hex2()[i][j]);
                      check_hex2[i][j] = pixel.display_img2Hex2()[i][j];
                      System.out.println("\nOutput Hex 2: " + check_hex2[i][j]);
                  }
                  if(!pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j]))
                  {
                      System.out.println("\nPixel values at position 4 are not the same." + "\n" + pixel.display_imgHex4()[i][j] + "  " + pixel.display_img2Hex4()[i][j]);
                      check_hex4[i][j] = pixel.display_img2Hex4()[i][j];
                      System.out.println("\nOutput Hex 4: " + check_hex4[i][j]);
                  }
                  if(!pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j]) || (!pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j])))
                  {
                      System.out.println("\nOne of the pixel values at position 2 and 4 are not the same." + "\n" + pixel.display_imgHex2()[i][j] + "  " + pixel.display_img2Hex2()[i][j] + "\n" + pixel.display_imgHex4()[i][j] + "  " + pixel.display_img2Hex4()[i][j]);
  
                      if(!pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j]) || (pixel.display_imgHex2()[i][j].equals(pixel.display_img2Hex2()[i][j])))
                      {
                          check_hex2[i][j] = pixel.display_img2Hex2()[i][j];
                          System.out.println("\nOutput Hex 2: " + check_hex2[i][j]);
                      }
  
                      if(!pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j]) || (pixel.display_imgHex4()[i][j].equals(pixel.display_img2Hex4()[i][j])))
                      {
                          check_hex4[i][j] = pixel.display_img2Hex4()[i][j];
                          System.out.println("\nOutput Hex 4: " + check_hex4[i][j]);
                      }
  
                  }
              count++;
              System.out.println("\nOutput Count: " + count);
          }
  
      }
  
  }
  
  public String[][] getCheck_hex2()
  {
      return check_hex2;
  }
  
  public String[][] getCheck_hex4()
  {
      return check_hex4;
  }
  }
  </code></pre>
  
  <p>Code for extractMessage method:</p>
  
  <pre><code>public class extractMessage
  {
  private static String character;
  private static String[][] char1;
  private static String[][] char2;
  private static int w;
  private static int h;
  private static String[][] in;
  
  public static void extractMessage(int width, int height, String[][] inn)
  {
      character = "";
      w = width;
      h = height;
      in = inn;
  }
  
  public static void printString2DArray(String[][] inn) 
  {
      for (int i = 0; i &lt; inn.length; i++) 
      {
          for(int j = 0; j &lt; inn[i].length; j++)
          {
              if (i != 0 &amp;&amp; j == 0)
              {
                  System.out.print(" ");
              }
              System.out.println(inn[i][j]);
          }
      }
  }
  
  public static void charExtract()
  {
      compareHexaRGB hexRGB = new compareHexaRGB();
  
      char1 = hexRGB.getCheck_hex2();
      char2 = hexRGB.getCheck_hex4();
      String[][] combine = char1 + char2;
  
      System.out.println("Char 1: ");
      printString2DArray(char1);
      System.out.println("Char 2: ");
      printString2DArray(char2);
  
  }
  }
  </code></pre>
  
  <p>OUTPUT:</p>
  
  <pre><code>Char 1: 
  null
  null
  null
  null
  null
  null
   null
  null
  6
  6
  null
  null
   6
  null
  null
  null
  null
  null
  Char 2: 
  null
  null
  null
  null
  null
  null
   null
  null
  2
  3
  null
  null
   1
  null
  null
  null
  null
  null
  </code></pre>
  
  <p>Any suggestion or correction I would highly appreciate! </p>