ArrayUtils { public static <T> int length( final T[] arrays) { if (null == arrays) { return 0; } return arrays.length; }  static boolean isEmpty(final T[] arrays); static int length(
      final T[] arrays); static byte[] concat(final byte[] left, final byte[] right);  }
@Test public void testLength() { final Object[][] testParameters = new Object[][] {{new String[] {}, 0}, {new String[] {"h", "e", "l", "l", "o"}, 5}, {new String[] {null}, 1}}; for (final Object[] testParameter : testParameters) { int expected = (Integer) testParameter[1]; String[] arrays = (String[]) testParameter[0]; assertEquals(expected, ArrayUtils.length(arrays)); } }
@Test public void shouldBeZeroOnNull() { assertEquals(0, ArrayUtils.length(null)); }