{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

RecBiggest - return biggest(number number.length-1 public...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
public class RecBiggest{ public static void main(String[] args){ int [] nums = new int[] {4,2,6,3}; System.out.println(biggest(nums)); nums = new int[] {4,2,6,7}; System.out.println(biggest(nums)); nums = new int[] {4,2,1,3}; System.out.println(biggest(nums)); } public static int biggest(int[] number){
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: return biggest(number, number.length-1); } public static int biggest(int[ ] number, int end){ if(end == 0){ return number[0]; } else { int restBig = biggest(number, end-1); if (number[end] > restBig){ return number[end]; } else { return restBig;} } } }...
View Full Document

{[ snackBarMessage ]}