public class DecimalFormatExample {
public static void main(String args[]) {
//formatting numbers upto 2 decimal places in Java
DecimalFormat df = new DecimalFormat("#,###,##0.00");
System.out.println(df.format(364565.14));
System.out.println(df.format(364565.1454));
//formatting numbers upto 3 decimal places in Java
df = new DecimalFormat("#,###,##0.000");
System.out.println(df.format(364565.14));
System.out.println(df.format(364565.1454));
}
}
Output:
364,565.14
364,565.15
364,565.140
364,565.145
Java - Format Number
Related Posts:
Shoplus 1. đăng sản phẩm lên Facebook từ Shoplus Chatbot này sẽ tự động kích hoạt khi bạn đăng sản phẩm lên Facebook từ Shoplus. Khi khách hàng bình luận dưới bài viết được đăng lên Trang Facebook từ Shoplus, Chattie sẽ … Read More
Giấy phép Phần mềm nguồn mở Phần mềm nguồn mở ( Open Source ) là những phần mềm được cung cấp dưới cả dạng mã và nguồn , không chỉ là miễn phí về giá mua mà chủ yếu là miễn phí về bản quyền : người dùng có quyền sửa đổi , cải tiến , phát triể… Read More
10 Best APP Development Courses for Beginners and Get a Job Here are 10 best Android and iOS APP development courses for beginners, and you can become an mobile APP developer by learning their detailed tutorials. According to Payscale’s survey, the current annual salar… Read More
Austrian Brokershttps://comparebrokers.co/compare/austrian-brokers/ https://www.fma.gv.at/ https://www.wienerborse.at/… Read More
10 cách học đầu tư chứng khoán cho người mới bắt đầu Để đầu tư thành công bạn cần được tiếp cận với một phương pháp đúng đắn ngay từ đầu. Một điều hấp dẫn của đầu tư chứng khoán đó là trò chơi sẽ kéo dài suốt đời. Bạn còn rất nhiều thời gian để phát triển các kỹ năng giao dị… Read More
0 comments:
Post a Comment