Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
なぜこれがうまくいかないのか誰か教えてください。文字列を小数点以下2桁にフォーマットしようとしているからだと確信しています..しかし、出力を小数点以下に丸める方法が他にわかりません。
DecimalFormat df = new DecimalFormat("#.##"); String sTotalCost = Double.toString(totalCost); txtTotalCost.setText("£" + df.format(sTotalCost));