Java Array Sort sort(double[] vector, boolean ascending)

Here you can find the source of sort(double[] vector, boolean ascending)

Description

sort

License

Apache License

Declaration

public static void sort(double[] vector, boolean ascending) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    public static void sort(double[] vector, boolean ascending) {

        Arrays.sort(vector);//from   w  ww .jav  a2 s.c o  m

        if (!ascending) {

            for (int i = 0; i <= (vector.length - 1) / 2; i++) {

                double tmp = vector[i];

                vector[i] = vector[vector.length - i - 1];
                vector[vector.length - i - 1] = tmp;
            }
        }
    }
}

Related

  1. sort(double[] a, int[] b)
  2. sort(double[] coords1, int length1, double[] coords2, int length2, int[] array)
  3. sort(double[] data)
  4. sort(double[] data, boolean desc)
  5. sort(Double[] inArray)
  6. sort(double[] x)
  7. sort(E[] x, int[] w)
  8. sort(final double[] data)
  9. sort(final int[] data)