usr/src/java/util/org/opensolaris/os/vp/util/misc/DataSizeUtil.java
changeset 685 767674b0a2fb
parent 591 7c5752b99fd6
equal deleted inserted replaced
684:f7b1d1fbdb8e 685:767674b0a2fb
    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) {