public class ArrayCopy {
public static void main(String[] args) {
String[] str={"京东","百度","阿里巴巴","腾讯","谷歌"};
str=extendRange(str);
}
public static void BasicCopy() {
String[] s = {"aa", "bb", "cc", "dd", "ee"};
String[] s1 = new String[10];
System.arraycopy(s, 3, s1, 6, 2);
for (int i = 0; i < s1.length; i++) {
System.out.println(i + "--" + s1[i]);
}
}
public static void BasicCopy1() {
String[] s = {"aa", "bb", "cc", "dd", "ee"};
System.arraycopy(s,3,s,3-1,s.length-3);
for (int i = 0; i < s.length; i++) {
System.out.println(i + "--" + s[i]);
}
}
public static void removeElment(String s[],int index) {
System.arraycopy(s, index+1 , s, index, s.length - index-1);
s[s.length-1]=null;
for (int i = 0; i < s.length; i++) {
System.out.println(i + "--" + s[i]);
}
}
public static String[] extendRange(String s[]) {
String[] s1=new String[s.length+10];
System.arraycopy(s, 0 , s1, 0, s.length);
for (String temp:s1) {
System.out.println(temp);
}
return s1;
}
}