Skip to content

Commit 0fb3bb5

Browse files
committed
add
1 parent f20639a commit 0fb3bb5

File tree

5 files changed

+56
-4
lines changed

5 files changed

+56
-4
lines changed
1.37 KB
Binary file not shown.
1.38 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.duweri.interview;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class FinalTest {
7+
8+
public static void main(String[] args) {
9+
int a = 10;
10+
System.out.println((a>>1)+5);
11+
System.out.println(a>>1);
12+
System.out.println(a<<1);
13+
final List<String> list = new ArrayList<>(10);
14+
System.out.println(list.size());
15+
for (int i = 0; i < 15; i++) {
16+
list.add(i+"");
17+
}
18+
System.out.println(list.size());
19+
for (String string : list) {
20+
System.out.println(string);
21+
}
22+
}
23+
24+
25+
}

src/com/duweri/interview/Sort.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static void shellSort(int[] arr){
5252
*/
5353
public static void bubbleSort(int[] arr){
5454
for (int i = 0; i <arr.length-1; i++) {//从后往前推小的
55-
for (int j = arr.length-1; j>i; j--) {
55+
for (int j = arr.length-1; j>i; j--) {//从最后一个开始遍历
5656
if (arr[j]>arr[j-1]) {
5757
int temp = arr[j];//swap
5858
arr[j] = arr[j-1];
@@ -64,9 +64,9 @@ public static void bubbleSort(int[] arr){
6464

6565
/**
6666
* 快速排序
67-
* 关键:1、选轴值
68-
* 2、一次划分
69-
* 3、递归快排
67+
* 关键: 1、选轴值
68+
* 2、一次划分
69+
* 3、递归快排
7070
*/
7171
public static void quickSort(int[] arr,int start,int end){
7272
if(start<end){
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.duweri.interview;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
public class SubStringTest {
7+
public static void main(String[] args) {
8+
SubStringTest.out();
9+
}
10+
11+
public static void out() {
12+
String str = "我爱你们,你爱他,他爱她们加一,她爱他";
13+
String temp = str + ",";
14+
List<String> list = new ArrayList<>();
15+
while (true) {
16+
String splitStr = null; // 保留截取的字符串
17+
int index = temp.indexOf(",");
18+
if (index < 0) {
19+
break;
20+
}
21+
splitStr = temp.substring(0, index);
22+
//System.out.println(splitStr);
23+
list.add(splitStr);
24+
temp = temp.substring(index + 1);
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)