-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsorting.java
More file actions
60 lines (49 loc) · 1.08 KB
/
sorting.java
File metadata and controls
60 lines (49 loc) · 1.08 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
public class sorting{
public static void main(String[] args){
char[][] arrayChar={{'E','D','G','A','R'},{'J','A','Y','M','A','R','K'},{'M','A','R','L','A'},{'R','H','A','Y','N','E','L'}
};
sort(arrayChar);
for(int i=0;i<arrayChar.length;i++){
for (int j=0;j<arrayChar[i].length ;j++ ) {
System.out.print(arrayChar[i][j]);
}
System.out.println();
}
showCoder();
}
static char[][] sort(char[][] array){
char[] temp;
for(int i=0;i<array.length;i++){
for(int j=i;j>=1;j--){
if(array[j][0]>array[j-1][0]){
temp=array[j];
array[j]=array[j-1];
array[j-1]=temp;
}
}
}
return array;
}
static void showCoder(){
char a=1;
System.out.println("\n\n\n\n");
for(int i=0;i<8;i++){
for(int j=0;j<15;j++){
if(i==7||i==0 || j==0 || j==14){
System.out.print("- ");
}
else if(i==2 && j==2)
{
System.out.print("Coded by: DevTulio "+a+" ");
}
else{
System.out.print(" ");
}
if(i==2 && j>3){
System.out.print("\b\b");
}
}
System.out.println();
}
}
}