Package java.math

Examples of java.math.BigInteger.multiply()


        }
        BigInteger x = new BigInteger("" + n);
        BigInteger result = x;
        for (int i = n - 1; i >= 2; i--) {
            x = x.subtract(BigInteger.ONE);
            result = result.multiply(x);
        }
        return result;
    }

}
View Full Code Here


           
            BigInteger b_dist = IDToBigInteger( dist );
           
            BigInteger  b_i = new BigInteger(""+i);
           
            sum1 = sum1.add( b_i.multiply(b_dist));
           
            sum2 = sum2.add( b_i.multiply( b_i ));
          }
         
          byte[]  max = new byte[id.length+1];
View Full Code Here

           
            BigInteger  b_i = new BigInteger(""+i);
           
            sum1 = sum1.add( b_i.multiply(b_dist));
           
            sum2 = sum2.add( b_i.multiply( b_i ));
          }
         
          byte[]  max = new byte[id.length+1];
         
          max[0] = 0x01;
View Full Code Here

      }
      while ( r.equals(ZERO) );

      BigInteger d = ((ECPrivateKeyParameters)key).getD();

      s = k.modInverse(n).multiply(e.add(d.multiply(r))).mod(n);
    }
    while ( s.equals(ZERO) );

        BigInteger[]  res = new BigInteger[2];
View Full Code Here

            }

            //
            // calculate the modulus
            //
            n = p.multiply(q);

            if (n.bitLength() == param.getStrength())
            {
              break;
            }
View Full Code Here

                numerator.add(BigInteger.valueOf(((Fixnum)obj).getValue()).multiply(denominator));
            return number(n, denominator);
        }
        if (obj instanceof Bignum) {
            BigInteger n = ((Bignum)obj).getValue();
            return number(numerator.add(n.multiply(denominator)),
                denominator);
        }
        if (obj instanceof Ratio) {
            BigInteger n = ((Ratio)obj).numerator;
            BigInteger d = ((Ratio)obj).denominator;
View Full Code Here

                numerator.subtract(BigInteger.valueOf(((Fixnum)obj).getValue()).multiply(denominator));
            return number(n, denominator);
        }
        if (obj instanceof Bignum) {
            BigInteger n = ((Bignum)obj).getValue();
            return number(numerator.subtract(n.multiply(denominator)),
                denominator);
        }
        if (obj instanceof Ratio) {
            BigInteger n = ((Ratio)obj).numerator;
            BigInteger d = ((Ratio)obj).denominator;
View Full Code Here

    BigInteger num = numerator.multiply(d);
    BigInteger den = denominator.multiply(n);
    BigInteger quotient = num.divide(den);

    // Multiply quotient by divisor.
    LispObject product = number(quotient.multiply(n), d);

    // Subtract to get remainder.
    LispObject remainder = subtract(product);

    final LispThread thread = LispThread.currentThread();
View Full Code Here

        }
        if (obj instanceof Bignum)
            return new Bignum(value.multiply(((Bignum)obj).value));
        if (obj instanceof Ratio) {
            BigInteger n = ((Ratio)obj).numerator();
            return number(n.multiply(value), ((Ratio)obj).denominator());
        }
        if (obj instanceof LispFloat)
            return new LispFloat(floatValue() * ((LispFloat)obj).getValue());
        throw new ConditionThrowable(new TypeError(obj, "number"));
    }
View Full Code Here

            return number(value, Fixnum.getBigInteger(obj));
        if (obj instanceof Bignum)
            return number(value, ((Bignum)obj).value);
        if (obj instanceof Ratio) {
            BigInteger d = ((Ratio)obj).denominator();
            return number(d.multiply(value), ((Ratio)obj).numerator());
        }
        if (obj instanceof LispFloat)
            return new LispFloat(floatValue() / ((LispFloat)obj).getValue());
        throw new ConditionThrowable(new TypeError(obj, "number"));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.