Java에서 데이터를 불러와 소수점 자릿수를 마음대로 조정 하고 싶을 때가 있다.
그럴 때는 다음과 같은 함수를 적용 해주면 좋을 듯 하다.
private String decimalFunction(double number)
{
String pattern = "0.###";
DecimalFormat df = new DecimalFormat(pattern);
return df.format(number);
}
{
String pattern = "0.###";
DecimalFormat df = new DecimalFormat(pattern);
return df.format(number);
}
댓글 없음:
댓글 쓰기