public static Integer[] increase(Integer[] src, int length) { |
if (src == null ) { |
return null ; |
} |
// 新建一个数组,长度为旧数组的长度加上length |
Integer[] result = new Integer[src.length + length]; |
// 新数组的前面部分的值与旧数组的值一样 |
// 这是一种常用的拷贝数组的方法 |
System.arraycopy(src, 0 , result, 0 , src.length); |
return result; |
} |