I know the answrs, but can you show the steps getting theanswers. i’m getting stuck on some of the tracing
public class TwoA {
public static void main(String[] args) {
final int SIZE =5;
int [] x = {19, 43,22, -1};
for (int i=0;i<x.length; i++) {
int currentMin = x[i];
int minIndex = i;
for (int j=i+1; j < x.length; j++) {
if (x[j] < currentMin) {
currentMin = x[j];
minIndex = j;
System.out.println(“Min: ” + j + ” ” + currentMin);
}
}
if (minIndex != i) {
x[minIndex] = x[i];
x[i] = currentMin;
System.out.println(“Swapped: ” + x[i] + ” ” + x[minIndex]);
}
}
}
}
ANS:
Min: 3 -1
Swapped: 19 -1
Min: 2 22
Min: 3 19
Swapped:
PayPal Gateway not configured
PayPal Gateway not configured