激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語(yǔ)言|JavaScript|易語(yǔ)言|vb.net|

服務(wù)器之家 - 編程語(yǔ)言 - Java教程 - java Arrays工具類實(shí)例詳解

java Arrays工具類實(shí)例詳解

2020-12-04 08:42神綺_H_亞里亞 Java教程

這篇文章主要介紹了java Arrays工具類實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下

Arrays工具類屬于java中常用的工具類

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public static void sort(int[] a)
public static void sort(int[] a,int fromIndex, int toIndex)
 
public static void sort(long[] a)
public static void sort(long[] a,int fromIndex, int toIndex)
 
public static void sort(short[] a)
public static void sort(short[] a,int fromIndex, int toIndex)
 
public static void sort(char[] a)
public static void sort(char[] a,int fromIndex, int toIndex)
 
public static void sort(byte[] a)
public static void sort(byte[] a,int fromIndex, int toIndex)
 
public static void sort(double[] a)
public static void sort(double[] a,int fromIndex, int toIndex)
 
public static void sort(float[] a)
public static void sort(float[] a,int fromIndex, int toIndex)

 對(duì)指定組的指定范圍按數(shù)字升序進(jìn)行排序。排序的范圍從索引 fromIndex(包括)一直到索引 toIndex(不包括)。(如果 fromIndex==toIndex,則排序范圍為空。)

a - 要排序的數(shù)組

fromIndex - 要排序的第一個(gè)元素的索引(包括)

toIndex - 要排序的最后一個(gè)元素的索引(不包括)

?
1
2
public static void sort(Object[] a)
public static void sort(Object[] a,int fromIndex, int toIndex)

 同上,不過數(shù)組中的所有元素都必須實(shí)現(xiàn) Comparable 接口。此外,數(shù)組中的所有元素都必須是可相互比較的(也就是說,對(duì)于數(shù)組中的任何 e1 和 e2 元素而言,e1.compareTo(e2) 不得拋出 ClassCastException)。

保證此排序是穩(wěn)定的:不會(huì)因調(diào)用 sort 方法而對(duì)相等的元素進(jìn)行重新排序。

?
1
2
public static <T> void sort(T[] a, Comparator<? super T> c)
public static <T> void sort(T[] a,int fromIndex,int toIndex,Comparator<? super T> c)

 根據(jù)指定比較器產(chǎn)生的順序?qū)χ付▽?duì)象數(shù)組進(jìn)行排序。數(shù)組中的所有元素都必須是通過指定比較器可相互比較的(也就是說,對(duì)于數(shù)組中的任何 e1 和 e2 元素而言,c.compare(e1, e2) 不得拋出 ClassCastException)。

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public static int binarySearch(long[] a,long key)
public static int binarySearch(long[] a,int fromIndex,int toIndex,long key)
 
public static int binarySearch(int[] a,int key)
public static int binarySearch(int[] a,int fromIndex,int toIndex,int key)
 
public static int binarySearch(short[] a,short key)
public static int binarySearch(short[] a,int fromIndex,int toIndex,short key)
 
public static int binarySearch(char[] a,char key)
public static int binarySearch(char[] a,int fromIndex,int toIndex,char key)
 
public static int binarySearch(byte[] a,byte key)
public static int binarySearch(byte[] a,int fromIndex,int toIndex,byte key)
 
public static int binarySearch(double[] a,double key)
public static int binarySearch(double[] a,int fromIndex,int toIndex,double key)
 
public static int binarySearch(float[] a,float key)
public static int binarySearch(float[] a,int fromIndex,int toIndex,float key)
 
public static int binarySearch(Object[] a,Object key)
public static int binarySearch(Object[] a,int fromIndex,int toIndex,Object key)
 
public static <T> int binarySearch(T[] a,T key,Comparator<? super T> c)
public static <T> int binarySearch(T[] a,int fromIndex,int toIndex,T key,Comparator<? super T> c)

 使用二分搜索法來搜索指定數(shù)組的范圍,以獲得指定對(duì)象。在進(jìn)行此調(diào)用之前,必須根據(jù)指定的比較器對(duì)范圍進(jìn)行升序排序。如果沒有對(duì)范圍進(jìn)行排序,則結(jié)果是不確定的。如果范圍包含多個(gè)等于指定對(duì)象的元素,則無法保證找到的是哪一個(gè)。

以上就是java Arrays工具類的實(shí)例詳解,關(guān)于java的文章本站還有很多,大家可以搜索參考,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

原文鏈接:http://yaliya.iteye.com/blog/2384942

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 福利在线免费 | 中日韩乱码一二新区 | 精品无吗乱吗av国产爱色 | 国产一级毛片在线看 | 久久久久久久国产视频 | 久久精品一二三区白丝高潮 | 国产成年人在线观看 | 嫩草影院在线观看网站成人 | 久久蜜桃精品一区二区三区综合网 | 欧美城网站地址 | www.91sese| 国产二区三区在线播放 | 在线日韩亚洲 | 国产在线区 | 欧美日韩国产一区二区三区在线观看 | 国产精品成人免费一区久久羞羞 | 国产在线精品一区二区 | 午夜在线视频一区二区三区 | 久久艹逼| 4p嗯啊巨肉寝室调教男男视频 | 一区二区三区毛片 | 一级黄色毛片a | 亚洲最大的成人网 | www.精品久久| 综合图区亚洲 | www.99re14.com| 国产视频在线免费观看 | 国产1区2区3区中文字幕 | 婷婷中文字幕一区二区三区 | 日韩精品中文字幕在线播放 | 国产午夜精品理论片a级探花 | 欧美女优一区 | av影院在线播放 | 久久狂草 | 久久成年网站 | 91成人在线免费观看 | 国产女厕一区二区三区在线视 | 艹男人的日日夜夜 | 欧洲成人综合网 | 久久久国产精品成人免费 | 涩涩屋av|