Answers for "java program to reverse an array of integer values"

1

reverse a integer in java

while(num != 0) 
{
   int digit = num % 10;
   reversed = reversed * 10 + digit;
   num /= 10;
}
Posted by: Guest on August-16-2020
0

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]
Posted by: Guest on October-31-2021

Code answers related to "java program to reverse an array of integer values"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language