Created
August 25, 2011 00:10
-
-
Save sujee/1169626 to your computer and use it in GitHub Desktop.
hadoop utilities : StringUtils 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.hadoop.util.StringUtils; | |
// --- human readable byte lengths ----- | |
System.out.println ("1024 bytes = " + StringUtils.byteDesc(1024)); | |
System.out.println ("67108864 bytes = " + StringUtils.byteDesc(67108864)); | |
System.out.println ("1000000 bytes = " + StringUtils.byteDesc(1000000)); | |
/* produces: | |
1024 bytes = 1 KB | |
67108864 bytes = 64 MB | |
1000000 bytes = 976.56 KB | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment