示例代碼
public class Company {
public static void main(String[] args) {
// 示例, 支持0.2開頭
String currentVoltage = "20.014";
// 轉換雙精度
int totalFee1 = (int) (Double.parseDouble(currentVoltage));
// 轉換單精度, 有時會使數據值變小;
int totalFee2 = (int) (Float.parseFloat(currentVoltage));
// 輸出 20 20
System.out.println("totalFee1:" + totalFee1 + ",totalFee2:" + totalFee2 + ".");
}
}