code: public static <T> T as(Object src, Class<T> type) {
          Class<?> t = type;
          while (t.isArray()) {
              t = t.getComponentType();
          }
          if (t == type) {
              // not an array at all
              return boxAs(src, type);
          } else {        
              if (t.isPrimitive()) {
                  return deepUnboxAs(src, type);
              } else {
                  return deepBoxAs(src, type);
              }
          }
      }
docs: Transforms any (multidimensional) array into an array of another type.
  @param <T>
  @param src source array
  @param type target type
  @return array