import java.util.Arrays;
public class JavaArray {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//创建一维数组:
int arr[] = new int[]{1,2,3,5,15};
int arr2[] = {23,12,6};
int day[] = new int[]{31,28,31,30,31,30,31,30,31,30,31,31};
for(int i=0;i<12;i++)
{
System.out.println((i+1)+"月有"+day[i]+"天");
}
//二级数组:
//int a[][] = new int[2][];
//a[0] = new int[2];
//a[1] = new int[3];
int a[][] = new int[][]{{1},{2,3},{4,5,6}};
for(int i=0;i<a.length;i++)
{
for(int j=0;j<a[i].length;j++)
{
System.out.println(a[i][j]);
}
System.out.println();
}
//填充替换数组元素:
//Arrays.fill(arr, 8); //用同一个数对数组进入填充
//fill(int[]a,int fromindex,int otIndex,int value);
//对数组进行排序:
int arr3[] = new int[]{23,42,12,8};
Arrays.sort(arr3);
for(int i=0;i<arr3.length;i++)
{
System.out.println(arr3[i]);
}
//复制数组:
//java.util.Arrays.copyOf(arr,5);
}
}