Пример #1
0
 public void testToStrc() {
   BigNum2 a = new BigNum2(STR);
   String str = null;
   long st = System.currentTimeMillis();
   for (int i = 0; i < MAX_CNT; i++) {
     str = a.toString();
   }
   long ed = System.currentTimeMillis() - st;
   System.out.println(str + ":" + ed + "ms");
   a = null;
 }
Пример #2
0
 public void testMulc() {
   BigNum2 a = new BigNum2(STR);
   BigNum2 b = new BigNum2(STR);
   long st = System.currentTimeMillis();
   for (int i = 0; i < MAX_CNT2; i++) {
     b = b.multiply(a);
   }
   long ed = System.currentTimeMillis() - st;
   System.out.println(b + ":" + ed + "ms");
   a = null;
   b = null;
 }
Пример #3
0
 public void testSubtractc() {
   BigNum2 a = new BigNum2(STR);
   BigNum2 b = new BigNum2(STR2);
   long st = System.currentTimeMillis();
   for (int i = 0; i < MAX_CNT; i++) {
     b = b.subtract(a);
   }
   long ed = System.currentTimeMillis() - st;
   System.out.println(b + ":" + ed + "ms");
   a = null;
   b = null;
 }
Пример #4
0
  public void testAddc() {
    BigNum2 a2 = new BigNum2(STR);
    BigNum2 b2 = new BigNum2(STR);

    long st = System.currentTimeMillis();
    for (int i = 0; i < MAX_CNT; i++) {
      b2 = b2.add(a2);
    }
    long ed = System.currentTimeMillis() - st;
    System.out.println(b2 + ":" + ed + "ms");
    a2 = null;
    b2 = null;
  }