Answers for "what does sort do in java"

2

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));
    }
}
Posted by: Guest on September-02-2021
0

java sort

javaCopyimport java.util.Arrays;

public class SimpleTesting {
	public static void main(String[] args) {	
		int[] arr = new int[]{12,3,5,21,4,85,6,9,2,1};
		for (int i : arr) {
			System.out.print(i+" ");
		}
		Arrays.parallelSort(arr);
		System.out.println("\nAfter Sorting...");
		for (int i : arr) {
			System.out.print(i+" ");
		}
	}
}
Posted by: Guest on May-11-2021

Code answers related to "what does sort do in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language