public MemorySize add ( MemorySize other ) { if ( other == null ) throw new NullPointerException ( ) ; if ( getSizeUnit ( ) == other . getSizeUnit ( ) ) return new MemorySize ( getSize ( ) + other . getSize ( ) , getSizeUnit ( ) ) ; return new MemorySize ( getSizeInBytes ( ) + other . getSizeInBytes ( ) , SizeUnit . BYTE ) ; }
Return a new instance of MemorySize that adds up the size of this object with that of the other