(int[] array)
| 5 | public class SwapMinMax { |
| 6 | |
| 7 | public static int getMinIndex(int[] array) { |
| 8 | int minIndex = 0; |
| 9 | for (int i = 1; i < array.length; i++) { |
| 10 | if (array[i] < array[minIndex]) { |
| 11 | minIndex = i; |
| 12 | } |
| 13 | } |
| 14 | return minIndex; |
| 15 | } |
| 16 | |
| 17 | public static int getMaxIndex(int[] array) { |
| 18 | int maxIndex = 0; |