public MemorySize truncate(SizeUnit sizeUnit)
  {
    if (getSizeUnit() == sizeUnit)
      return this;

    long sizeInBytes = getSizeInBytes();

    if (sizeInBytes >= sizeUnit.getBytesCount())
    {
      return new MemorySize(sizeInBytes / sizeUnit.getBytesCount(), sizeUnit);
    }
    else
    {
      return ZERO_SIZES.get(sizeUnit);
    }
  }
public MemorySize truncate(SizeUnit sizeUnit)
  {
    if (getSizeUnit() == sizeUnit)
      return this;

    long sizeInBytes = getSizeInBytes();

    if (sizeInBytes >= sizeUnit.getBytesCount())
    {
      return new MemorySize(sizeInBytes / sizeUnit.getBytesCount(), sizeUnit);
    }
    else
    {
      return ZERO_SIZES.get(sizeUnit);
    }
  }
public MemorySize truncate ( SizeUnit sizeUnit ) { if ( getSizeUnit ( ) == sizeUnit ) return this ; long sizeInBytes = getSizeInBytes ( ) ; if ( sizeInBytes >= sizeUnit . getBytesCount ( ) ) { return new MemorySize ( sizeInBytes / sizeUnit . getBytesCount ( ) , sizeUnit ) ; } else { return ZERO_SIZES . get ( sizeUnit ) ; } }
Return a new instance of MemorySize that is truncated to the given unit

@param sizeUnit
@return a new instance of MemorySize that is truncated to the given unit
Return a new instance of MemorySize that is truncated to the given unit