Java Array Swap swap(final float[] pVertices, final int pVertexStride, final int pVertexIndexA, final int pVertexIndexB)

Here you can find the source of swap(final float[] pVertices, final int pVertexStride, final int pVertexIndexA, final int pVertexIndexB)

Description

swap

License

Apache License

Declaration

public static void swap(final float[] pVertices,
            final int pVertexStride, final int pVertexIndexA,
            final int pVertexIndexB) 

Method Source Code

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

public class Main {
    public static void swap(final float[] pVertices,
            final int pVertexStride, final int pVertexIndexA,
            final int pVertexIndexB) {
        final int vertexOffsetA = pVertexIndexA * pVertexStride;
        final int vertexOffsetB = pVertexIndexB * pVertexStride;

        for (int i = pVertexStride - 1; i >= 0; i--) {
            final float tmp = pVertices[vertexOffsetA + i];
            pVertices[vertexOffsetA + i] = pVertices[vertexOffsetB + i];
            pVertices[vertexOffsetB + i] = tmp;
        }//from  w w  w .  ja v a2  s. c  o m
    }
}

Related

  1. swap(double[] a, int i, int j)
  2. swap(double[] array, int i, int j)
  3. swap(double[] data, int i, int j)
  4. swap(final byte[] array, int firstIndex, int secondIndex)
  5. swap(final byte[] src)
  6. swap(final int a[], final int i, final int j)
  7. swap(final int[] array, final int i, final int j)
  8. swap(final int[] array, final int indexA, final int indexB)
  9. swap(final int[] array, final int pos1, final int pos2)