Revert order of vector elements. - Java XML

Java examples for XML:DOM Element

Description

Revert order of vector elements.

Demo Code


//package com.java2s;

public class Main {
    /**/*from   w  w w .jav  a  2s .c o m*/
     * Revert order of vector elements.
     */
    public static void revert(double[] data) {
        double t;
        for (int i = 0; i < Math.floor(data.length / 2.); i++) {
            t = data[i];
            data[i] = data[data.length - 1 - i];
            data[data.length - 1 - i] = t;
        }
    }
}

Related Tutorials