1public class maxDifference {
2
3public static void main(String[] args) {
4
5 int[] a = {1,4,8,15,17};
6
7 int diff = 0;
8
9 for(int i = 0; i < a.length-1 ; i++){
10
11 if(a[i+1] - a[i] > diff)
12 {
13 diff = a[i+1] - a[i];
14
15 }
16 }
17
18 System.out.println(diff);
1public class maxDifference {
2
3public static void main(String[] args) {
4
5 int[] a = {1,4,8,15,17};
6
7 int diff = 0;
8
9 for(int i = 0; i < a.length-1 ; i++){
10
11 if(a[i+1] - a[i] > diff)
12 {
13 diff = a[i+1] - a[i];
14
15 }
16 }
17
18 System.out.println(diff);
19
20