I need a data type that behaves completely like Integer with this difference that I want it to overflow and underflow to certain values. On the other words, I’d like to set the MAX_VALUE and MIN_VALUE of an object/instance of the Integer class. The problem is MAX_VALUE and MIN_VALUE are constant and Integer class in final. How should I approach?
I need a data type that behaves completely like Integer with this difference that
Share
You’ll have to create your own wrapper class:
You need to decide whether you want one fixed pair of limits for the whole type, or whether each instance can have a different limit (and what that means when adding together two values with different limits etc).