Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 0; i < SIZE; i++) {
- higharray[i] = r.readInt("Enter an integer: ");
- if (i == 0) {
- first = higharray[0];
- firstloc = arraylocs[0];
- }
- if (i == 1) {
- if (higharray[1] > higharray[0]) {
- second = higharray[0];
- secondloc = arraylocs[0];
- }
- }
- if (i == 2) {
- if (higharray[2] > first) {
- third = second;
- thirdloc = secondloc;
- } else if (higharray[2] > second) {
- third = second;
- thirdloc = secondloc;
- }
- }
- if (higharray[i] > first) {
- thirdloc = secondloc;
- third = second;
- secondloc = firstloc;
- second = first;
- first = higharray[i];
- firstloc = arraylocs[i];
- } else if (higharray[i] > second) {
- thirdloc = secondloc;
- third = second;
- second = higharray[i];
- secondloc = arraylocs[i];
- } else if (higharray[i] > third) {
- third = higharray[i];
- thirdloc = arraylocs[i];
- }
- System.out.println(first + " " + second + " " + third);
- System.out.println(firstloc + " " + " " + secondloc + " "
- + thirdloc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement