File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ public static String capitalize(String fieldName){
94
94
//**************************************************************************
95
95
//** rtrim
96
96
//**************************************************************************
97
+ /** Used to remove whitespaces at the end of a given string
98
+ */
97
99
public static String rtrim (String s ) {
98
100
int i = s .length ()-1 ;
99
101
while (i >= 0 && Character .isWhitespace (s .charAt (i ))) {
@@ -119,6 +121,25 @@ public static String getElapsedTime(long startTime){
119
121
}
120
122
121
123
124
+ //**************************************************************************
125
+ //** formatFileSize
126
+ //**************************************************************************
127
+ public static String formatFileSize (long size ){
128
+ if (size >0 ){
129
+ size = size /1024 ;
130
+ if (size <=1 ) return "1 KB" ;
131
+ else {
132
+ size = size /1024 ;
133
+ if (size <=1 ) return "1 MB" ;
134
+ else {
135
+ return format (Math .round (size )) + " MB" ;
136
+ }
137
+ }
138
+ }
139
+ return "" ;
140
+ };
141
+
142
+
122
143
//**************************************************************************
123
144
//** format
124
145
//**************************************************************************
You can’t perform that action at this time.
0 commit comments