static <T> T findFirstValidInput(T[] inputs) {
    for (T input : inputs) {
      if (input != null) {
        return input;
      }
    }

    throw new HadoopIllegalArgumentException(
        "Invalid inputs are found, all being null");
  }
@Test
  public void testFindFirstValidInput() {
    byte[][] inputs = new byte[numInputs][];
    inputs[8] = ByteBuffer.allocate(4).putInt(1234).array();

    byte[] firstValidInput = CoderUtil.findFirstValidInput(inputs);
    assertEquals(firstValidInput, inputs[8]);
  }