I am writing a program that creates a large number of large arrays for storing data. All this data needs to be stored in RAM, so I avoid objects and currently use shorts to save space. These shorts serve as identification numbers that can be placed in the search class to get the corresponding object on demand. I recently asked a question about whether I need only 2 bytes of short code, and so now I wonder if one way or another, to determine the type of data stored in one place in my code so that I can easily change it, track down each type, return type, etc. that is currently set to short.
If I were ready to use objects, I could just simply do
class MySmallNumber extends Short{}
and change the parent class if necessary.
If it is C / C ++, I could use
#define small short
for the effect I'm looking for.
I am looking for a way to do something like this in java, which does not require storing 64-bit object references in my arrays. Any help is appreciated. Now I am looking at a really dirty IDE to do this.
source share