0

How to build a **case sensitive** bubble sort and selection sort for a 2 dim array

Here is what i currently have but it does not work properly

```
static void bubblesort(String[][] Array){
String datae = null;
String temps;
String tempse;
for(int x=1;x<i;x++)
{
for(int y=0;y<i-x;y++)
{
if(Array[y][1].compareTo(Array[y+1][1])>0)
{
temps=Array[y][1];
Array[y][1]=Array[y+1][1];
Array[y+1][1]=temps;
tempse=Array[y][0];
Array[y][0]=Array[y+1][0];
Array[y+1][0]=tempse;
tempse=Array[y][2];
Array[y][2]=Array[y+1][2];
Array[y+1][2]=tempse;
}
}
}
System.out.println("Bubble Sorted");
for (int z = 0; z < i; z++){
datae = Array[z][0];
Array[z][1]= datae.substring(0, 1).toLowerCase();
System.out.println(Array[z][2] + ":" + Array[z][1]+":" +Array[z][0]);
}
}
//selection sort method
static void selectionSort(String[][] arrays)
{
String data = null;
for (int e = 1; e < i; e++) {
// find the index of the ith smallest value
int s = e-1;
for (int j = e; j < i; j++) {
if (arrays[j][0].compareTo(arrays[s][0]) < 0) {
s = j;
}
}
// swap the ith smallest value into entry i-1
String temp = arrays[e-1][0];
arrays[e-1][0] = arrays[s][0];
arrays[s][0] = temp;
temp = arrays[e-1][2];
arrays[e-1][2] = arrays[s][2];
arrays[s][2] = temp;
}
System.out.println("Selection Sorted");
for (int z = 0; z < i; z++){
data = arrays[z][0];
arrays[z][1]= data.substring(0, 1).toLowerCase();
System.out.println(arrays[z][2] + ":" + arrays[z][1]+":" +arrays[z][0]);
}
}
```