Java Array Invert invert(int[] v)

Here you can find the source of invert(int[] v)

Description

Inverts an array from left to right.

License

Open Source License

Declaration

public static int[] invert(int[] v) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**// w  w  w.  j a v a2s .  c  o  m
     * Inverts an array from left to right.
     */
    public static double[] invert(double[] v) {
        double[] w = new double[v.length];
        for (int k = 0; k < v.length; k++) {
            w[v.length - 1 - k] = v[k];
        }
        return (w);
    }

    /**
     * Inverts an array from left to right.
     */
    public static int[] invert(int[] v) {
        int[] w = new int[v.length];
        for (int k = 0; k < v.length; k++) {
            w[v.length - 1 - k] = v[k];
        }
        return (w);
    }
}

Related

  1. invert(byte[] v)
  2. invert(double[] ary)
  3. invert(float[] a)
  4. invert(float[] m, float[] invOut)
  5. invert(int[] bits)
  6. invert(int[][] clustered)
  7. invert(Object[] array)
  8. invert(Object[] objArray)
  9. invert(T[] array)