Manager - File Size

public String getFileSizes(long size) {

if(size <= 0) return "0";
final String[] units = new String[] { "B", "KB", "MB", "GB", "TB", "PB", "EB" };
int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
String result = null;
result = new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
return result;
}

Komentar

Cara pembuatan Apps paling Populer

Create Stopwatch App in Android using Sketchware

How to enable download in webview in Sketchware apps?

TextInputLayout in Sketchware

Create Stopwatch App in Android using Sketchware

How to integrate Admob Ads in Sketchware project using AIDE?

How to find and​ highlight a word in a text field in Sketchware?

Code for implementing Notifications in Sketchware

A Flash Light App in Sketchware

Create a Stopwatch App using Chronometer in Sketchware

Create app to save all passwords, protected using voice key