I don't understande why this is not working: (method is taken from HERE on SO).
private String MakeSizeHumanReadable(int bytes, boolean si) {
    int unit = si ? 1000 : 1024;
    if (bytes < unit) return bytes + " B";
    int exp = (int) (Math.log(bytes) / Math.log(unit));
    String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
    String hr = String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
    hr = hr.replace("-1 B", "n.a.");
    return hr;
}
and neither this one:-
private String MakeSizeHumanReadable(int bytes, boolean si) {
    int unit = si ? 1000 : 1024;
    if (bytes < unit) return bytes + " B";
    int exp = (int) (Math.log(bytes) / Math.log(unit));
    String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i");
    String hr = String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
    Pattern minusPattern = Pattern.compile("-1 B");
    Matcher minusMatcher = minusPattern.matcher(hr);
    if (minusMatcher.find()) {
        return "n.a.";
    } else {
        return hr;
    }
}
from time to time I get -1 B from the request (this is normal), that is never changed in n.a. (....my question).
Does anyone have an idea?
 
     
    