code: public static boolean isArray( Object obj ) {
        if( (obj != null && obj.getClass()
              .isArray()) || (obj instanceof Collection) || (obj instanceof JSONArray) ){
           return true;
        }
        return false;
     }
docs: Tests if obj is an array or Collection.