Server/Java
Java String to Int(Minus or decimal point) 소수점, 음수 형변환
selfstarter
2020. 5. 11. 18:16
Java String to Int(Minus or decimal point)
- How to String to Int with Minus or decimal point
- String에서 숫자로 형변환하기
String num1 = "2000.000";
String num2 = "-400.0";
// Convert String to Float before Round.. after result is Int type
int charge1 = Math.round(Float.parseFloat(num1));
int charge2 = Math.round(Float.parseFloat(num2));