BTW you can write
int[] arr = { 20, 40, 60, 40, 60, 100 }; System.out.println(Arrays.toString(array));
or even
System.out.println(Arrays.toString(new int[] { 20, 40, 60, 40, 60, 100 }));
or
System.out.println(Arrays.asList(20, 40, 60, 40, 60, 100));
Peter Lawrey
source share