*/
public static boolean orderOfPermutationIsOdd(final byte[] permutation) {
//decompose this permutation into product of cycles and calculate parity of l.c.m. of their sizes
//to mark viewed points
BitArray used = new BitArray(permutation.length);
int start, pointer, currentSize, counter = 0;
//while not all points are seen
//loop over cycles
while (counter < permutation.length) {
//get first point that was not already traversed
start = pointer = used.nextZeroBit(0);
currentSize = 0;
//processing current cycle
//loop over current cycle
do {
assert !used.get(pointer);
used.set(pointer);
pointer = permutation[pointer];
++currentSize;
} while (pointer != start);
if (currentSize % 2 == 0)
return false;