Java BigInteger Calculate distance(BigInteger a, BigInteger b)

Here you can find the source of distance(BigInteger a, BigInteger b)

Description

return the distance between two number, that is |a-b|.

License

Open Source License

Parameter

Parameter Description
a BigInteger
b BigInteger

Return

BigInteger

Declaration

public static final BigInteger distance(BigInteger a, BigInteger b) 

Method Source Code


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

import java.math.BigInteger;

public class Main {
    /**/*from   w  ww  .j a v  a2  s .c o  m*/
     * return the distance between two number, that is |a-b|.
     * no checking is done.
     * @param a BigInteger
     * @param b BigInteger
     * @return BigInteger
     */
    public static final BigInteger distance(BigInteger a, BigInteger b) {
        return a.subtract(b).abs();
    }
}

Related

  1. decodeBigInteger(String value)
  2. decodeBitListFromBigInteger(BigInteger bits)
  3. decodeFloat(BigInteger rawSign, BigInteger rawExponent, BigInteger rawMantissa, int signWidth, int exponentWidth, int mantissaWidth, int bias, MathContext mc)
  4. decodeToBigInteger(String input)
  5. DiffieHellman(BigInteger p, BigInteger g, BigInteger x, BigInteger y, BigInteger y_B)
  6. distance(BigInteger a, BigInteger b)
  7. div(BigInteger dividend, BigInteger divisor)
  8. divide(BigInteger dividend, BigInteger divisor)
  9. dump(BigInteger x)