code: @Override
    public int compareTo(MemorySize memorySize)
    {
      // according to javadoc for interface Comparable<T>, a NullPointerException
      // should be thrown when the object to be compared with is null
      // http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Comparable.html#compareTo(T)
      if (memorySize == null)
        throw new NullPointerException();
  
      if (getSizeUnit() == memorySize.getSizeUnit())
        return LangUtils.compare(getSize(), memorySize.getSize());
  
      return LangUtils.compare(getSizeInBytes(), memorySize.getSizeInBytes());
    }
docs: Compare with another instance of MemorySize based on size in bytes
  
  @see java.lang.Comparable#compareTo(java.lang.Object)