title: Converting HashMap into Array
body: <p>I have a HashMap which I want to convert into a array.
  Which the code below, I get following:
  [[2, 11, 10, 9], [value1, value2, value3, value4], [null, null, null, null], [null, null, null, null]]
  The "null" entries give me a null pointer exception. Why is it two times as big as it should be? I just want the real entries:
  [[2, 11, 10, 9], [value1, value2, value3, value4]]. What did I wrong?</p>
  
  <pre><code>String[][] test = getArrayFromHash(hashmap);
  
      public static String[][] getArrayFromHash(HashMap&lt;String, String&gt; hashMap){
          String[][] str = null;
          {
              Object[] keys = hashMap.keySet().toArray();
              Object[] values = hashMap.values().toArray();
              str = new String[keys.length][values.length];
              for(int i=0;i&lt;keys.length;i++) {
                  str[0][i] = (String)keys[i];
                  str[1][i] = (String)values[i];
              }
          }
          return str;
      }
  </code></pre>
  
  <p>Thanks!</p>