code: public static void checkArray(Object[] array, String arrayName) {
          if (array == null) {
              throw new IllegalArgumentException(arrayName
                      + " cannot be null");
          }
          if (array.length == 0) {
              throw new IllegalArgumentException(arrayName
                      + " cannot be empty");
          }
          checkArrayForNullElement(array, arrayName);
      }
docs: Checks if the specified array is null, has length zero or has null
  values. If any of those criteria are me, an
  {@link IllegalArgumentException} is thrown.
  
  @param array an {@link Object[]}.
  @param arrayName the variable name {@link String} of the array (
  used in the exception message). Should not be <code>null</code>, or the
  exception message will not indicate which parameter was erroneously
  <code>null</code>.