aboutsummaryrefslogtreecommitdiff
path: root/src/utilities/ScientificFormatter.java
blob: 65c8afef8cb9aa79ddfc0e25af7896eec657de0e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*    */ package utilities;
/*    */ 
/*    */ public class ScientificFormatter extends DecimalFormatter
/*    */ {
/*    */   private int base;
/*    */ 
/*    */   public ScientificFormatter(int radix, int base, boolean flt)
/*    */   {
/* 14 */     super(radix, flt);
/* 15 */     this.base = base;
/*    */   }
/*    */   public String format(String str) {
/* 18 */     if (Double.parseDouble(str) < this.base) return str;
/* 19 */     String temp = super.scientificNotation(str);
/* 20 */     String exp = temp.substring(temp.lastIndexOf("*10^") + 4);
/* 21 */     temp = temp.substring(0, temp.lastIndexOf("*10^") + 4);
/* 22 */     exp = BaseConverter.convertFromDecimal(Long.parseLong(exp), this.base);
/*    */ 
/* 24 */     return temp + exp;
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     utilities.ScientificFormatter
 * JD-Core Version:    0.6.2
 */