equal
deleted
inserted
replaced
18 * |
18 * |
19 * CDDL HEADER END |
19 * CDDL HEADER END |
20 */ |
20 */ |
21 |
21 |
22 /* |
22 /* |
23 * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
24 */ |
24 */ |
25 |
25 |
26 package org.opensolaris.os.vp.util.misc; |
26 package org.opensolaris.os.vp.util.misc; |
27 |
27 |
28 import java.text.DecimalFormat; |
28 import java.text.DecimalFormat; |
195 } |
195 } |
196 |
196 |
197 DataSize dataSize = getDataSize(bytes, precision, units, unit); |
197 DataSize dataSize = getDataSize(bytes, precision, units, unit); |
198 |
198 |
199 // Build format string |
199 // Build format string |
200 StringBuffer pattern = new StringBuffer(); |
200 StringBuilder pattern = new StringBuilder(); |
201 pattern.append(useCommas ? "#,##0" : "###0"); |
201 pattern.append(useCommas ? "#,##0" : "###0"); |
202 char formatChar = |
202 char formatChar = |
203 (forcePrecision && dataSize.unitsIndex != 0) ? '0' : '#'; |
203 (forcePrecision && dataSize.unitsIndex != 0) ? '0' : '#'; |
204 for (int j = 0; j < precision; j++) { |
204 for (int j = 0; j < precision; j++) { |
205 if (j == 0) { |
205 if (j == 0) { |