code: public int[] createIntArray(Integer[] integers) {
          int[] result;
          if (integers != null) {
              int count = 0;
              int inputLength = integers.length;
              int[] tempResult = new int[inputLength];
              for (int i = 0; i < inputLength; i++) {
                  if (integers[i] != null) {
                      tempResult[count] = integers[i].intValue();
                      count++;
                  }
              }
              result = tempResult;
              if (count != inputLength) {
                  result = new int[count];
                  System.arraycopy(tempResult, 0, result, 0, count);
              }
          } else {
              result = null;
          }
  
          return result;
      }
docs: Create an array of <code>int</code> values from the given array of
  {@link Integer} values. Each value in the given array will be unwrapped
  to its primitive form. If any values within the given array are
  <code>null</code>, then they will be ignored and the resulting array will
  be smaller than the given array.
  
  @param integers The array of integers to convert
  
  @return The array of primitive ints