Java Array Unique invertRelabeling(int[] relabeling, int[] uniqueVars, int maxVarNum)

Here you can find the source of invertRelabeling(int[] relabeling, int[] uniqueVars, int maxVarNum)

Description

invert Relabeling

License

Open Source License

Declaration

private static int[] invertRelabeling(int[] relabeling,
            int[] uniqueVars, int maxVarNum) 

Method Source Code

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

import java.util.Arrays;

public class Main {
    private static int[] invertRelabeling(int[] relabeling,
            int[] uniqueVars, int maxVarNum) {
        int[] inverseRelabeling = new int[maxVarNum + 1];
        Arrays.fill(inverseRelabeling, -1);
        for (int i = 0; i < relabeling.length; i++) {
            if (relabeling[i] != -1) {
                inverseRelabeling[relabeling[i]] = uniqueVars[i];
            }//w  w  w.j  a  v  a 2  s  .  co m
        }
        return inverseRelabeling;
    }
}

Related

  1. countUnique(int[][] array)
  2. getUniqueIDsArray(int[] idArray, String ids, String seperator)
  3. getUniqueItems(final String[] allItems, final String newItem, final int maxItems)
  4. getUniqueWords(String[] input)
  5. unique(double[] in)
  6. unique(int[] a, int aLen, int[] b, int bLen)
  7. unique(int[] array)
  8. unique(Object[] elements)