JAVA
sort array java
import java. util. Arrays;
Arrays. sort(array);
sort method in java array
import java.util.Arrays;
import java.util.Collections;
class ArraySort {
public static void main(String[] args) {
Integer[] arr = { 5, 2, 1, 8, 10 };
Arrays.sort(arr, Collections.reverseOrder());
for (int values : arr) {
System.out.print(values + ", ");
// 10, 8, 5, 2, 1,
}
}
}
Array Sort java
import java.util.Arrays;
Arrays.sort(/*Enter the name of the Array*/);
sorting java
public class SortingData {
public static void main(String[] args)
{
int[] arr = { 13, 7, 6, 45, 21, 9, 101, 102 };
Arrays.sort(arr);//sort() function
System.out.printf("Modified arr[] : %s",
Arrays.toString(arr));
}
}
java array sortieren
int[] intArray = {1, 5, 3, 7, 2, 9};
Arrays.sort(intArray);
System.out.println(Arrays.toString(intArray));
// Ausgabe: [1, 2, 3, 5, 7, 9]
java program to sort an array
import java.util.Arrays;
class GFG {
public static void main(String args[])
{
int[] arr = { 5, -2, 23, 7, 87, -42, 509 };
System.out.println("The original array is: ");
for (int num : arr) {
System.out.print(num + " ");
}
Arrays.sort(arr);
System.out.println("
The sorted array is: ");
for (int num : arr) {
System.out.print(num + " ");
}
}
}
sort method in java array
import java.util.Arrays;
import java.util.Collections;
class ArraySort {
public static void main(String[] args) {
Integer[] arr = { 5, 2, 1, 8, 10 };
Arrays.sort(arr, Collections.reverseOrder());
for (int values : arr) {
System.out.print(values + ", ");
// 10, 8, 5, 2, 1,
}
}
}
Array Sort java
import java.util.Arrays;
Arrays.sort(/*Enter the name of the Array*/);
Array Sort java
import java.util.Arrays;
Arrays.sort(/*Enter the name of the Array*/);
java sort method
Arrays.sort();//this method is an inbuild function in java
//to sort the array
sort java array
import java. util. Arrays;
// int[] arr = {1,7,3,5};
Arrays.sort(myArr);
java order an array