Java tutorial
//package com.java2s; /************************************************************************ VisualOn Proprietary Copyright (c) 2013, VisualOn Incorporated. All Rights Reserved VisualOn, Inc., 4675 Stevens Creek Blvd, Santa Clara, CA 95051, USA All data and information contained in or disclosed by this document are confidential and proprietary information of VisualOn, and all rights therein are expressly reserved. By accepting this material, the recipient agrees that this material and the information contained therein are held in confidence and in trust. The material may only be used and/or disclosed as authorized in a license agreement controlling such use and disclosure. ************************************************************************/ public class Main { /** convert bitrate To String*/ public static String bitrateToString(int nBitr) { String s; nBitr /= 1024; if (nBitr < 1024) { s = Integer.toString(nBitr) + "k"; } else { String str = Float.toString(nBitr / 1024.0f); int n = str.indexOf('.'); if (n >= 0 && n < str.length() - 2) str = str.substring(0, n + 2); s = (str + "m"); } return s; } }