| 发表于:2007-09-14 23:19:491楼 得分:5 |
....动态数组用容器 或者看看这个动态扩展数组的方法.. public static object arraygrows(object oldarray) { class cl = oldarray.getclass(); if(!cl.isarray()) return null; class componenttype = cl.getcomponenttype(); int length = array.getlength(oldarray); int newlength = length * 11/10 + 10; object newarray = array.newinstance(componenttype, newlength); system.arraycopy(oldarray, 0, newarray, 0, length); return newarray; } | | |
|