Advertisement
sshomette

Untitled

Aug 27th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. for (int i = 0; i < SIZE; i++) {
  2. higharray[i] = r.readInt("Enter an integer: ");
  3. if (i == 0) {
  4. first = higharray[0];
  5. firstloc = arraylocs[0];
  6. }
  7. if (i == 1) {
  8. if (higharray[1] > higharray[0]) {
  9. second = higharray[0];
  10. secondloc = arraylocs[0];
  11. }
  12. }
  13. if (i == 2) {
  14. if (higharray[2] > first) {
  15. third = second;
  16. thirdloc = secondloc;
  17.  
  18. } else if (higharray[2] > second) {
  19. third = second;
  20. thirdloc = secondloc;
  21.  
  22. }
  23. }
  24. if (higharray[i] > first) {
  25. thirdloc = secondloc;
  26. third = second;
  27. secondloc = firstloc;
  28. second = first;
  29. first = higharray[i];
  30. firstloc = arraylocs[i];
  31. } else if (higharray[i] > second) {
  32. thirdloc = secondloc;
  33. third = second;
  34. second = higharray[i];
  35. secondloc = arraylocs[i];
  36. } else if (higharray[i] > third) {
  37.  
  38. third = higharray[i];
  39. thirdloc = arraylocs[i];
  40. }
  41. System.out.println(first + " " + second + " " + third);
  42. System.out.println(firstloc + " " + " " + secondloc + " "
  43. + thirdloc);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement