toTwosComplement = function (number) {
    var bigNumber = toBigNumber(number).round();
    if (bigNumber.lessThan(0)) {
        return new BigNumber("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16).plus(bigNumber).plus(1);
    }
    return bigNumber;
}
Takes and input transforms it into bignumber and if it is negative value, into two's complement

@method toTwosComplement
@param {Number|String|BigNumber}
@return {BigNumber}