code: public static String getLocalizedFileSize(final Context context, double numSize) {
  
          String localeLanguage = Locale.getDefault().getLanguage();
          if (!SIZE_LANGUAGE.equals(localeLanguage) && context != null && context.getResources() != null) {
              Resources resources = context.getResources();
              SIZE_BYTES = resources.getString(R.string.boxsdk_bytes);
              SIZE_KILOBYTES = resources.getString(R.string.boxsdk_kilobytes);
              SIZE_MEGABYTES = resources.getString(R.string.boxsdk_megabytes);
              SIZE_GIGABYTES = resources.getString(R.string.boxsdk_gigabytes);
              SIZE_TERABYTES = resources.getString(R.string.boxsdk_terabytes);
              SIZE_LANGUAGE = localeLanguage;
          }
  
          String textSize = null;
          double size;
  
          if (numSize < constKB) {
              textSize = String.format(Locale.getDefault(), SIZE_BYTES, numSize);
          } else if ((numSize >= constKB) && (numSize < constMB)) {
              size = numSize / floatKB;
              textSize = String.format(Locale.getDefault(), SIZE_KILOBYTES, size);
          } else if ((numSize >= constMB) && (numSize < constGB)) {
              size = numSize / floatMB;
              textSize = String.format(Locale.getDefault(), SIZE_MEGABYTES, size);
          } else if (numSize >= constGB && (numSize < constTB)) {
              size = numSize / floatGB;
              textSize = String.format(Locale.getDefault(), SIZE_GIGABYTES, size);
          } else if (numSize >= constTB) {
              size = numSize / floatTB;
              textSize = String.format(Locale.getDefault(), SIZE_TERABYTES, size);
          }
          return textSize;
      }
docs: Java version of routine to turn a long into a short user readable string.
  
  This routine is used if the JNI native C version is not available.
  
  @param numSize the number of bytes in the file.
  @return String Short human readable String e.g. 2.5 MB