Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Help method for secondMax
- */
- private int helpSecondMax(int[] v, int max, int index) {
- while (index < v.length) {
- if (max < v[index]) {
- max = v[index];
- }
- helpSecondMax(v, max, (index+1));
- }
- return max;
- }
- /**
- * My second method for finding the largest value in an array
- */
- public int secondMax(int[] v) {
- return helpSecondMax(v, 0, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement