- Timestamp:
- Feb 11, 2018 8:59:58 PM (3 years ago)
- Branches:
- master
- Children:
- 012fb4ca
- Parents:
- 31719d3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
core/java/src/net/i2p/data/DataHelper.java
r31719d3 rf13f4fc 1556 1556 case 7: return str + "Zi"; 1557 1557 case 8: return str + "Yi"; 1558 default: return bytes + "";1558 default: return Long.toString(bytes); 1559 1559 } 1560 1560 } … … 1590 1590 */ 1591 1591 public static String formatSize2(long bytes, boolean nonBreaking) { 1592 String space = nonBreaking ? " " : " "; 1593 if (bytes < 1024) 1594 return bytes + space; 1592 1595 double val = bytes; 1593 1596 int scale = 0; … … 1598 1601 1599 1602 DecimalFormat fmt = new DecimalFormat("##0.00"); 1603 if (val >= 200) { 1604 fmt.setMaximumFractionDigits(0); 1605 } else if (val >= 20) { 1606 fmt.setMaximumFractionDigits(1); 1607 } 1600 1608 1601 1609 // Replace with thin non-breaking space   (more consistent/predictable width between fonts & point sizes) 1602 1610 1603 String space = nonBreaking ? " " : " ";1604 1611 String str = fmt.format(val) + space; 1605 1612 switch (scale) { … … 1644 1651 */ 1645 1652 public static String formatSize2Decimal(long bytes, boolean nonBreaking) { 1653 String space = nonBreaking ? " " : " "; 1654 if (bytes < 1000) 1655 return bytes + space; 1646 1656 double val = bytes; 1647 1657 int scale = 0; … … 1651 1661 } 1652 1662 DecimalFormat fmt = new DecimalFormat("##0.00"); 1653 String space = nonBreaking ? " " : " "; 1663 if (val >= 200) { 1664 fmt.setMaximumFractionDigits(0); 1665 } else if (val >= 20) { 1666 fmt.setMaximumFractionDigits(1); 1667 } 1654 1668 String str = fmt.format(val) + space; 1655 1669 switch (scale) {
Note: See TracChangeset
for help on using the changeset viewer.