Changeset d7e5aaf
- Timestamp:
- Mar 6, 2017 3:46:56 AM (4 years ago)
- Branches:
- master
- Children:
- 4bf0147
- Parents:
- 10a021f
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java
r10a021f rd7e5aaf 2566 2566 private static String formatSize(long bytes) { 2567 2567 if (bytes < 5000) 2568 return bytes + " B"; 2568 2569 // replace with narrow non-breaking space ( ) 2570 return bytes + " B"; 2569 2571 else if (bytes < 5*1024*1024) 2570 return ((bytes + 512)/1024) + "& nbsp;KB";2572 return ((bytes + 512)/1024) + " KB"; 2571 2573 else if (bytes < 10*1024*1024*1024l) 2572 return ((bytes + 512*1024)/(1024*1024)) + "& nbsp;MB";2574 return ((bytes + 512*1024)/(1024*1024)) + " MB"; 2573 2575 else 2574 return ((bytes + 512*1024*1024)/(1024*1024*1024)) + "& nbsp;GB";2576 return ((bytes + 512*1024*1024)/(1024*1024*1024)) + " GB"; 2575 2577 } 2576 2578 … … 2943 2945 double ratio = uploaded / ((double) snark.getTotalLength()); 2944 2946 buf.append((new DecimalFormat("0.000")).format(ratio)); 2945 buf.append("& nbsp;x");2947 buf.append(" x"); 2946 2948 } else { 2947 2949 buf.append('0'); -
core/java/src/net/i2p/data/DataHelper.java
r10a021f rd7e5aaf 1561 1561 DecimalFormat fmt = new DecimalFormat("##0.00"); 1562 1562 1563 // Replace with thin non-breaking space   (more consistent/predictable width between fonts & point sizes) 1564 1563 1565 String str = fmt.format(val); 1564 1566 switch (scale) { 1565 case 1: return str + "& nbsp;K";1566 case 2: return str + "& nbsp;M";1567 case 3: return str + "& nbsp;G";1568 case 4: return str + "& nbsp;T";1569 case 5: return str + "& nbsp;P";1570 case 6: return str + "& nbsp;E";1571 case 7: return str + "& nbsp;Z";1572 case 8: return str + "& nbsp;Y";1573 default: return bytes + "& nbsp;";1567 case 1: return str + " K"; 1568 case 2: return str + " M"; 1569 case 3: return str + " G"; 1570 case 4: return str + " T"; 1571 case 5: return str + " P"; 1572 case 6: return str + " E"; 1573 case 7: return str + " Z"; 1574 case 8: return str + " Y"; 1575 default: return bytes + " "; 1574 1576 } 1575 1577 }
Note: See TracChangeset
for help on using the changeset viewer.