This way, weird file system sizes display nicely.
Without this a mountpoint with a size of 1.68GB
displays as 1GB.
Change-Id: I72e0d8ff911dd942efd5860f2d86607ebbb30fcb
R.string.size_gigabytes
};
- long aux = size;
+ double aux = size;
int cc = magnitude.length;
for (int i = 0; i < cc; i++) {
- long s = aux / 1024;
if (aux < 1024) {
- return Long.toString(aux) + " " + res.getString(magnitude[i]); //$NON-NLS-1$
+ double cleanSize = Math.round(aux * 100);
+ return Double.toString(cleanSize / 100) +
+ " " + res.getString(magnitude[i]); //$NON-NLS-1$
+ } else {
+ aux = aux / 1024;
}
- aux = s;
}
- return Long.toString(aux) + " " + res.getString(magnitude[cc - 1]); //$NON-NLS-1$
+ double cleanSize = Math.round(aux * 100);
+ return Double.toString(cleanSize / 100) +
+ " " + res.getString(magnitude[cc - 1]); //$NON-NLS-1$
}
/**