Arrays.parallelSort(double[]) in Java

Arrays.parallelSort(double[]): This method is available in java.util.Arrays class of Java.

Syntax:

void java.util.Arrays.parallelSort(double[] a)

This method takes one argument of type double array as its parameter. This method sorts the specified array into ascending numerical order.

Parameters: One parameter is required for this method.

a: the array to be sorted.

Returns: NA

Exceptions: NA

Approach

Java

import java.util.Arrays;

public class ArraysparallelSortdouble {
    public static void main(String[] args) {

        double a[] = { 12, 77, 56, 18 };
        Arrays.parallelSort(a);

        System.out.println(Arrays.toString(a));
    }
}

Output:

[12.0, 18.0, 56.0, 77.0]


No comments:

Post a Comment