Package java.math

Examples of java.math.BigInteger.multiply()


    }

    BigInteger s_1 = input.modPow(dP, p);
    BigInteger s_2 = input.modPow(dQ, q);
    BigInteger h = qInv.multiply(s_1.subtract(s_2)).mod(p);
    return s_2.add(h.multiply(q));

  }

  public static BigInteger getPrimeExponent(BigInteger privateExponent,
                                            BigInteger prime) {
View Full Code Here


            } catch (TypedXMLStreamException xse) { ; // good
            }
            sr.close();

            // And then, let's just multiply by 10, add a new digit
            I = I.multiply(BigInteger.valueOf(10)).add(BigInteger.valueOf(rnd.nextInt() & 0xF));

            // Plus switch sign every now and then
            if ((i % 3) == 0) {
                I = I.negate();
            }
View Full Code Here

        BigInteger I = BigInteger.valueOf(3);
        Random rnd = new Random(2);
        for (int i = 1; i < 200; ++i) {
            assertXML("<root>"+I+"</root>", writeIntegerElemDoc("root", I));
            assertXML("<a attr='"+I+"'></a>", writeIntegerAttrDoc("a", "attr", I));
            I = I.multiply(BigInteger.valueOf(10)).add(BigInteger.valueOf(rnd.nextInt() & 0xF));
        }
    }

    public void testBigDecimal()
        throws XMLStreamException
View Full Code Here

     */
    public void setFontSize(int size) {
  BigInteger bint=new BigInteger(""+size);
        CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr();
        CTHpsMeasure ctSize = pr.isSetSz() ? pr.getSz() : pr.addNewSz();
        ctSize.setVal(bint.multiply(new BigInteger("2")));
    }

    /**
     * This element specifies the amount by which text shall be raised or
     * lowered for this run in relation to the default baseline of the
View Full Code Here

   
    private static BigInteger sqrt(BigInteger x) {
      BigInteger y = BigInteger.ZERO;
      for (int i = (x.bitLength() - 1) / 2; i >= 0; i--) {
        y = y.setBit(i);
        if (y.multiply(y).compareTo(x) > 0)
          y = y.clearBit(i);
      }
      return y;
    }
   
View Full Code Here

      return false;
   
    BigInteger base = BigInteger.valueOf(digitSum);
    BigInteger pow = base;
    while (pow.compareTo(x) < 0)
      pow = pow.multiply(base);
    return pow.compareTo(x) == 0;
  }
 
 
  private static int digitSum(BigInteger x) {
View Full Code Here

    while (exp != 0) {
      if ((exp & 1) != 0) {
        result = result.multiply(base);
      }
      exp >>= 1;
      base = base.multiply(base);
    }
    return result;
  }

  public static int bitAnd_(int receiver, int other) {
View Full Code Here

 
  public String run() {
    int sum = 0;
    for (int i = 1; i <= 100; i++) {
      BigInteger x = BigInteger.valueOf(i);
      x = x.multiply(BigInteger.TEN.pow(100 * 2))// Shift left so that we can obtain 100 digits after the decimal point
      BigInteger y = sqrt(x);
      if (!y.multiply(y).equals(x)) {  // Skip perfect squares
        // Strip rightmost digits so that we have exactly 100 decimal digits (some are before the decimal point)
        String s = y.toString().substring(0, 100);
        for (int j = 0; j < s.length(); j++)
View Full Code Here

    int sum = 0;
    for (int i = 1; i <= 100; i++) {
      BigInteger x = BigInteger.valueOf(i);
      x = x.multiply(BigInteger.TEN.pow(100 * 2))// Shift left so that we can obtain 100 digits after the decimal point
      BigInteger y = sqrt(x);
      if (!y.multiply(y).equals(x)) {  // Skip perfect squares
        // Strip rightmost digits so that we have exactly 100 decimal digits (some are before the decimal point)
        String s = y.toString().substring(0, 100);
        for (int j = 0; j < s.length(); j++)
          sum += s.charAt(j) - '0';
      }
View Full Code Here

    BigInteger ways = Library.factorial(BASE);
    for (int x : histogram)
      ways = ways.divide(Library.factorial(x));
   
    // Multinomial coefficient: LENGTH! / (freqs[0]! * freqs[1]! * ...)
    ways = ways.multiply(Library.factorial(LENGTH));
    for (int x : freqs)
      ways = ways.divide(Library.factorial(x));
   
    return ways;
  }
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.