I'm trying to sort an int array with the Arrays.sort method, but it deletes everything in my array and replaces it with 0. What is happening here? It's printing the correct numbers the first time around, but after I sort it, it has replaced everything with 0. It runs through the loop a couple of times, and each time I get more and more numbers in the array, but it's never the correct ones.
while(rs.next()){
amount[0] = rs.getInt("ramamount");
amount[1] = rs.getInt("casesamount");
amount[2] = rs.getInt("mainboardamount");
amount[3] = rs.getInt("cpuamount");
amount[4] = rs.getInt("gfxamount");
String nome = rs.getString("nome");
System.out.println(nome + ": RAM=" + amount[0] + " CASES=" + amount[1] + " MAINBOARD=" + amount[2] + " CPU=" + amount[3] + " GFX=" + amount[0]);
Arrays.sort(amount);
System.out.println(amount[0] + ", " + amount[1]+ ", " + amount[2]+ ", " + amount[3]+ ", " + amount[4]);
}