int[] numbers = {10,20,30,40,50};
String[] indexElements = IntStream.range(0, numbers.length).mapToObj(i -> i + ":" + numbers[i]).toArray(String[]::new);
System.out.println(" "+ Arrays.toString(indexElements));
------------------------------------------------------------------------------
int[] numbers = {10,20,30,40,50};
int sum = IntStream.of(numbers).sum();
System.out.println(" "+ sum);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter