Skip to content
Advertisement

Tag: slice

Java – Slice any array at steps

In python we are able to do the following: Is there an equivalent to this in Java? I have been looking for this type of array slicing, but I have had no luck. Any help would be great, Thanks! Answer If you are using Java 8, then you can make use of streams and do the following: Outputs: [0, 3,

Advertisement