Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x[] = { 1, 2, 3, 4, 5 };
- int length = x.length / 2;
- IntStream right = IntStream.range(1, length + 1)
- .mapToObj(i -> new Integer[] { -1 * i, i })
- .flatMap(Arrays::stream)
- .mapToInt(i -> x[length + i]);
- IntStream res = IntStream.concat(IntStream.of(x[length]), right);
- res.forEach(System.out::println);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement