Java Utililty Methods Array Invert

List of utility methods to do Array Invert

Description

The list of methods to do Array Invert are organized into topic(s).

Method

int[]invertList(int[] pos)
invert List
int[] result = new int[pos.length];
for (int i = 0; i < pos.length; i++) {
    result[pos[i]] = i;
return result;
int[]invertMap(int[] map)
invert Map
int[] re = new int[max(map) + 1];
Arrays.fill(re, -1);
for (int i = 0; i < map.length; i++)
    re[map[i]] = i;
return re;
voidinvertMapping(int[] mapping)
Inverts the mapping into the source array.
invertMapping(mapping, mapping);
voidinvertOrder(double[] values)
Inverts the order of the values in an array of doubles.
final int length = values.length;
final int halfLength = length / 2;
for (int i = 0; i < halfLength; i++) {
    final double temp = values[i];
    values[i] = values[length - i - 1];
    values[length - i - 1] = temp;
voidinvertOrientation(int[] face)
inverts the order of the vertexIndices
int[] result = new int[face.length];
for (int i = 0; i < result.length; i++) {
    result[i] = face[(face.length - i - 1)];
System.arraycopy(result, 0, face, 0, face.length);
voidinvertValues(double[] vector)
invert Values
for (int i = 0; i < vector.length; i++)
    vector[i] = 1.0 / vector[i];
int[]InvertVector(int v[])
Invert Vector
int[] a = new int[v.length];
for (int i = 0; i < v.length; i++) {
    a[i] = v[v.length - 1 - i];
return a;