Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

reverse int array java

import java.util.*;
import java.util.stream.Collectors;

int[] array = new int[] {23, 54, 12};
List<Integer> list = Arrays.stream(array).boxed().collect(Collectors.toList());
Collections.reverse(list);
array = list.stream().mapToInt(x -> x).toArray();
//array = [12,54,23]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reverse #int #array #java
ADD COMMENT
Topic
Name
1+3 =