H, i am a learner- please help with this array problem. I have to find the next number in this array sequence. Sample Input and Output:
5--n total numbers to be entered. 2 3 5 4 1
Next customer id is 6.
import java.util.Scanner; public class help1 { public static void main(String[] args){ Scanner scan = new Scanner(System.in); int num = 0; int missingTrack = 0; System.out.println("Enter number of sequence:"); int n = scan.nextInt(); int id[] = new int[n]; for(int i=0; i<n; i++) { id[i] = scan.nextInt(); } for(int i=0; i<n; i++) { if(i==n-1) { break; } Arrays.sort(id); for (i=0;i== n-1;i++) { int next=id[i]+1; } } System.out.println("Next customer id is"+next); } }