src/main/java/Fibonacci.java
/**
     * Generate the nth Fibonacci number
     * @param n order of the number (can be signed)
     * @return the nth Fibonacci number
     */
Generate the nth Fibonacci number
@param n order of the number (can be signed)
@return the nth Fibonacci number
Generate the nth Fibonacci number @param n order of the number ( can be signed ) @return the nth Fibonacci number
public static BigInteger fib(BigInteger n) {
        if (n.equals(BigInteger.ZERO)){
            return n;
        }
        int sign = n.signum();
        if (sign < 0){
            n = n.negate();
            if (n.mod(BigInteger.TWO).longValue() == 0)
                return fib(n).negate(); 
            return fib(n); 
        }
        return power(n.longValue() - 1)[0][0];
    }
public static BigInteger fib ( BigInteger n ) { if ( n . equals ( BigInteger . ZERO ) ) { return n ; } int sign = n . signum ( ) ; if ( sign < 0 ) { n = n . negate ( ) ; if ( n . mod ( BigInteger . TWO ) . longValue ( ) == 0 ) return fib ( n ) . negate ( ) ; return fib ( n ) ; } return power ( n . longValue ( ) - 1 ) [ 0 ] [ 0 ] ; }
Generate the nth Fibonacci number
 @param n order of the number (can be signed)
 @return the nth Fibonacci number
Generate the nth Fibonacci number @param n order of the number ( can be signed ) @return the nth Fibonacci number
// negate the even ones // else use the abs value