public class ChenqiArray {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto
RisingsoftArray raOne=new RisingsoftArray();
int newLength=raOne
for(int i=
raOne
System
}
newLength=raOne
for(int i=
raOne
System
}
newLength=raOne
raOne
for(int i=
System
}
}
}
class RisingsoftArray{
private Object[] obj;
//constructor
public RisingsoftArray(int ArrayLength){
if(ArrayLength>=
obj=new Object[ArrayLength];
}
}
public RisingsoftArray(){
this(
}
public RisingsoftArray(Object[] obj){
this
}
//get the Array items count
public int getArrayCount(){
return (obj!=null)?obj
}
//auto expand the Array and copy the items
public void expandArray(int n){
if(n>
Object[] newObj=new Object[n];
for(int i=
obj=newObj;
}
}
//get access
public Object getItem(int pos){
return (pos>=
}
//set access
public void setItem(int pos
if(pos>=
this
}
else if (pos>
expandArray(pos+
setItem(pos
}
}
//clone a Array
public static Object[] cloneArray(Object[] obj){
if(obj
return null;
}
else{
Object[] newObj=new Object[obj
for(int i=
return newObj;
}
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25972.html