About 14,000,000 results
Open links in new tab
  1. java - How do I print a sorted array? - Stack Overflow

    If all you want to do is print the sorted array, simply print the elements in a for loop after the array is sorted: for(int i=0; i < intArray.length; i++) { System.out.println(intArray[i]); }

  2. Arrays.sort() in Java - GeeksforGeeks

    Apr 8, 2025 · The Arrays.sort() method is used for sorting the elements in an Array. It has two main variations: Sorting the entire array (it may be an integer or character array) Sorting a …

  3. Java sort Arraylist and return sorted list - Stack Overflow

    Mar 1, 2016 · if you want the sorted List to be separated from the original one, do it like this. /** * @param input The unsorted list * @return a new List with the sorted elements */ public static …

  4. java - Sorting arrays in method and returning to main method

    Sep 5, 2013 · Create a separate function that will sort the array and return the array back to the main method and print it there. So far I have done: import java.util.*; public class arraysort { …

  5. Java Arrays. sort() Method - W3Schools

    The sort() method sorts an array in ascending order. This method sorts arrays of strings alphabetically, and arrays of integers numerically.

  6. Java How To Sort an Array - W3Schools

    You can use the sort() method, found in java.util.Arrays, to sort an array: Example import java.util.Arrays; public class Main { public static void main(String[] args) { String[] cars = …

  7. Sorting in Java - GeeksforGeeks

    Mar 15, 2024 · In Java, sorting an array consists of arranging the elements in a particular order, such as ascending or descending. This can be achieved using various algorithms like Bubble …

  8. How to sort a List/ArrayList? | JanBask Training Community

    1 day ago · The simplest way to sort a List or ArrayList is by using the static method Collections.sort(). List numbers = new ArrayList>(Arrays.asList ... return this.age - other.age; // …

  9. Java Array Sorting: Methods, Tips, and Examples

    Nov 9, 2023 · Java provides a built-in method, Arrays.sort(), to sort an array. This method sorts the array’s elements into ascending order, applicable to different types of arrays such as …

  10. Arrays (Java Platform SE 8 ) - Oracle Help Center

    The sorting algorithm is a parallel sort-merge that breaks the array into sub-arrays that are themselves sorted and then merged. When the sub-array length reaches a minimum …

  11. Some results have been removed
Refresh