mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-16 18:10:13 +08:00
修改错误并格式化代码
This commit is contained in:
parent
32456ca43e
commit
ce9c4417cb
@ -251,7 +251,7 @@ unmodifiableXxx(): 返回指定集合对象的不可变视图,此处的集合
|
||||
System.out.println();
|
||||
|
||||
int c[] = { 1, 3, 2, 7, 6, 5, 4, 9 };
|
||||
// parallelSort(int[] a) 按照数字顺序排列指定的数组。同sort方法一样也有按范围的排序
|
||||
// parallelSort(int[] a) 按照数字顺序排列指定的数组(并行的)。同sort方法一样也有按范围的排序
|
||||
Arrays.parallelSort(c);
|
||||
System.out.println("Arrays.parallelSort(c):");
|
||||
for (int i : c) {
|
||||
@ -285,6 +285,9 @@ System.out.println(Arrays.toString(strs));//[abcdeag, abcdefg, abcdehg]
|
||||
```java
|
||||
// *************查找 binarySearch()****************
|
||||
char[] e = { 'a', 'f', 'b', 'c', 'e', 'A', 'C', 'B' };
|
||||
// 排序后再进行二分查找,否则找不到
|
||||
Arrays.sort(e);
|
||||
System.out.println("Arrays.sort(e)" + Arrays.toString(e));
|
||||
System.out.println("Arrays.binarySearch(e, 'c'):");
|
||||
int s = Arrays.binarySearch(e, 'c');
|
||||
System.out.println("字符c在数组的位置:" + s);
|
||||
@ -377,4 +380,3 @@ System.out.println(Arrays.toString(strs));//[abcdeag, abcdefg, abcdehg]
|
||||
// 换行
|
||||
System.out.println();
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user