code: public int sgn() {
          // Is there a way to compute the parity while performing the permutations
          // making this much less expensive
          int total = 0;
  
          for( int i = 0; i < ret.length; i++ ) {
              int val = ret[i];
  
              for( int j = i+1; j < ret.length; j++ ) {
                  if( val > ret[j] ) {
                      total++;
                  }
              }
          }
  
          if( total % 2 == 1 )
              return -1;
          return 1;
      }
docs: <p>
  Returns signature of the permutation.  This is the sgn() operator and returns
  -1 or 1 depending on it being odd or even.
  <br>
  sgn(σ) = ( − 1)<sup>m</sup><br>
  <br>
  where m is the number of inversions.
  </p>
  <p>
  NOTE: This implementation is painfully slow O(N!).  There is probably another algorithm out there
  which is much faster.
  </p>
  
  @return -1 or 1 for odd or even permutations.