code: private static double[] toDoubleAray(Integer[] intArray, HashSet<Integer> skipIndex) {
      double[] res = new double[intArray.length - skipIndex.size()];
      int skip = 0;
      for (int i = 0; i < intArray.length; i++) {
        if (skipIndex.contains(i)) {
          skip++;
          continue;
        }
        res[i - skip] = intArray[i].doubleValue();
      }
      return res;
    }
docs: Converts an array into array of doubles skipping specified indeces.
  
  @param intArray the input array.
  @param skipIndex skip index list.
  @return array of doubles.