Some commonly used small method collections in java

Some commonly used small method collections in java

1. Format decimals (retain a few decimal places)
// Keep two decimal places
DecimalFormat decimalFormat = new DecimalFormat("#0.00");
String str = decimalFormat.format(number);
//Display the white ratio
DecimalFormat decimalFormat1 = new DecimalFormat ("#0.00%");
String str = decimalFormat1.format(number);

2. HTML title with picture syntax
<link rel="shortcut icon" type="image/x-icon" href="image path">

Guess you like

Origin blog.csdn.net/weixin_52065369/article/details/114156336