Android Array Reverse reverse(final double[] pArray)

Here you can find the source of reverse(final double[] pArray)

Description

reverse

Declaration

public static final void reverse(final double[] pArray) 

Method Source Code

//package com.java2s;

public class Main {
    public static final void reverse(final byte[] pArray) {
        if (pArray == null) {
            return;
        }/* w  ww . j a  v a2 s .c  om*/
        int i = 0;
        int j = pArray.length - 1;
        byte tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final short[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        short tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final int[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        int tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final long[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        long tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final float[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        float tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final double[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        double tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }

    public static final void reverse(final Object[] pArray) {
        if (pArray == null) {
            return;
        }
        int i = 0;
        int j = pArray.length - 1;
        Object tmp;
        while (j > i) {
            tmp = pArray[j];
            pArray[j] = pArray[i];
            pArray[i] = tmp;
            j--;
            i++;
        }
    }
}

Related

  1. reverse(double[] array)
  2. reverse(final Object[] pArray)
  3. reverse(final Object[] pArray)
  4. reverse(final byte[] pArray)
  5. reverse(final byte[] pArray)
  6. reverse(final double[] pArray)
  7. reverse(final float[] pArray)
  8. reverse(final float[] pArray)
  9. reverse(final int[] array)