Code example for DecimalFormat

Methods: applyPattern, format

0
        millis /= 60;
        int hours = (int) millis;
 
        String time;
        DecimalFormat format = (DecimalFormat)NumberFormat.getInstance(Locale.US);
        format.applyPattern("00");
        if (millis > 0) {
            time = (negative ? "-" : "") + hours + ":" + format.format(min) + ":" + format.format(sec);
        } else { 
            time = (negative ? "-" : "") + min + ":" + format.format(sec);
        } 
        return time;
    } 
 
    public static Bitmap scaleDownBitmap(Context context, Bitmap bitmap, int width) {
        /* 
         * This method can lead to OutOfMemoryError! 
         * If the source size is more than twice the target size use 
         * the optimized version available in AudioUtil::readCoverBitmap 
         */ 
        if (bitmap != null) {