java数组

来源:互联网 发布:深圳奥凯软件 编辑:程序博客网 时间:2024/06/14 03:58

1.type[]=array.copyof(type[],length):数组拷贝

2.System.arraycopy(),实现数组的整体赋值

public static void arraycopy(Object src,                             int srcPos,                             Object dest,                             int destPos,                             int length)

其中:src表示源数组,srcPos表示源数组要复制的起始位置,desc表示目标数组,length表示要复制的长度。

3.int=array.binarysearch(type[],int start(起点),int end(终点后一个位置),type c):数组中二分查找c,返回一个索引,没有则返回-1。

4.equals(type a[],type b[])

5.多维数组:int[][] a=new int[2][2]

1)快速打印:println(array.deeptostring(a))

2)foreach遍历:需要嵌套for(int[] row:a){for(int value:a)}


原创粉丝点击