public static <T> int getNullIndex(final T[] array) {
    for (int i = 0; i < array.length; i++) {
      if (array[i] == null) {
        return i;
      }
    }
    return -1;
  }
@Test
  public void shouldGetCorrectNullIndex() {
    final Double[] doubles1 = new Double[]{10.0, null, null};
    final Double[] doubles2 = new Double[]{null, null, null};
    final Double[] doubles3 = new Double[]{10.0, 9.0, 8.0};

    assertThat(ArrayUtil.getNullIndex(doubles1), equalTo(1));
    assertThat(ArrayUtil.getNullIndex(doubles2), equalTo(0));
    assertThat(ArrayUtil.getNullIndex(doubles3), equalTo(-1));
  }