Back to project page Ocypode.
The source code is released under:
MIT License
If you think the Android project Ocypode listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ocypode.utility.formatter; // w w w . j av a 2s . c o m import java.math.RoundingMode; import java.text.DecimalFormat; import java.text.NumberFormat; public class NumberFormatter { public static CharSequence formatDecimalWithTwoMaximumFractionDigits(double value) { NumberFormat df = DecimalFormat.getInstance(); df.setMaximumFractionDigits(2); df.setRoundingMode(RoundingMode.DOWN); return df.format(value); } public static CharSequence getAbsNumberWithFormat(String valeu) { NumberFormat nf = NumberFormat.getInstance(); long absValue = Math.abs(Long.parseLong(valeu)); return nf.format(absValue); } }