code: @SuppressWarnings("fallthrough")
      public static long convertToMachineFriendlyByteSize(String size) {
          double d;
          try {
              d = Double.parseDouble(size.replaceAll("[GMK]?[B]?$", ""));
          } catch (NumberFormatException e)  {
              String msg = "Size must be specified as bytes (B), " +
                      "kilobytes (KB), megabytes (MB), gigabytes (GB). " +
                      "E.g. 1024, 1KB, 10M, 10MB, 100G, 100GB";
              throw new NumberFormatException(msg + " " + e.getMessage());
          }
          long l = Math.round(d * 1024 * 1024 * 1024L);
          int index = Math.max(0, size.length() - (size.endsWith("B") ? 2 : 1));
          switch (size.charAt(index)) {
              default:  l /= 1024;
              case 'K': l /= 1024;
              case 'M': l /= 1024;
              case 'G': return l;
          }
      }
docs: Convert byte size into machine friendly format.
  
  @param size the human friendly byte size (includes units)
  @return a number of bytes
  @throws NumberFormatException if failed parse given size