Bytes to KB : Byte « Date Type « Android

Home
Android
1.2D Graphics
2.Animation
3.Core Class
4.Database
5.Date Type
6.Development
7.File
8.Game
9.Hardware
10.Media
11.Network
12.Security
13.UI
14.User Event
Android » Date Type » Byte 
Bytes to KB
   
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;


 class ParseUtility {

    public static String bytes2kb(long bytes) {
        BigDecimal filesize = new BigDecimal(bytes);
        BigDecimal megabyte = new BigDecimal(1024 1024);
        float returnValue = filesize.divide(megabyte, , BigDecimal.ROUND_UP).floatValue();
        if (returnValue > 1)
            return(returnValue + " MB");
        BigDecimal kilobyte = new BigDecimal(1024);
        returnValue = filesize.divide(kilobyte, , BigDecimal.ROUND_UP).floatValue();
        return (returnValue + " KB");
    }
  
}

   
    
    
  
Related examples in the same category
1.Four Bytes To Long
2.Byte Convert
3.unsigned Byte To Int
4.Byte Converter
5.byte To Unsigned Int
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.