public static Object arrayGrow(Object obj,int addlength){
        Class c = obj.getClass();
if(!c.isArray()){
return null;
        }
        Class type = c.getComponentType();
int length = Array.getLength(obj);
int newlength = length+addlength;
        Object newArray = Array.newInstance(type, newlength);
        System.arraycopy(obj, 0, newArray, 0, length);
return newArray;
    }

相关文章:

  • 2021-04-23
  • 2021-12-18
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-05-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-08-15
  • 2021-06-28
  • 2021-07-30
相关资源
相似解决方案