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[]invert(int[] bits)
invert
for (int i = 0; i < bits.length; i++) {
    bits[i] = ~bits[i];
return bits;
int[]invert(int[] v)
Inverts an array from left to right.
int[] w = new int[v.length];
for (int k = 0; k < v.length; k++) {
    w[v.length - 1 - k] = v[k];
return (w);
Mapinvert(int[][] clustered)
Map index to cluster from cluster array
int cluster = 0;
Map<Integer, Integer> ret = new HashMap<Integer, Integer>();
for (int[] is : clustered) {
    for (int index : is) {
        ret.put(index, cluster);
    cluster++;
return ret;
voidinvert(Object[] array)
invert
int i, j;
Object cell;
for (i = 0, j = array.length - 1; i < j; i++, j--) {
    cell = array[i];
    array[i] = array[j];
    array[j] = cell;
voidinvert(Object[] objArray)
This method inverts the order of the elements in objArray.
if (objArray != null) {
    int changes = objArray.length / 2;
    for (int i = 0; i < changes; i++) {
        Object temp = objArray[i];
        objArray[i] = objArray[objArray.length - i - 1];
        objArray[objArray.length - i - 1] = temp;
T[]invert(T[] array)
Inverts the array.
if (array == null)
    return null;
int j = array.length - 1;
for (int i = 0; i < array.length / 2; i++) {
    T element = array[i];
    array[i] = array[j];
    array[j--] = element;
return array;
voidinvert3x3(float m[], float inv[])
Inverts the given matrix and writes the result into the given target matrix.
float m0 = m[0];
float m1 = m[1];
float m2 = m[2];
float m3 = m[3];
float m4 = m[4];
float m5 = m[5];
float m6 = m[6];
float m7 = m[7];
...
voidinvert4x4(float m[], float inv[])
Inverts the given matrix and writes the result into the given target matrix.
float m0 = m[0];
float m1 = m[1];
float m2 = m[2];
float m3 = m[3];
float m4 = m[4];
float m5 = m[5];
float m6 = m[6];
float m7 = m[7];
...
byte[]invertArray(final byte[] array)
invert Array
byte[] temp = array.clone();
for (int i = 0; i < array.length; i++)
    array[i] = temp[array.length - i - 1];
return array;
int[]invertArray(int[] a, int top)
Invert an array.
int[] r = new int[top];
int ri = 0;
for (int i = 0; i < top; ++i) {
    if (!inArray(i, a)) {
        r[ri++] = i;
return shrinkArray(r, ri);
...