I have a class that contains defines 'magic' numbers at compile time such as basic array sizes, fixed ip address, etc. so that I have one place to edit if changes are required.
In this nested class I need to define tuples of maximum and minimum values that correspond to each of 4 bands of an IR camera. I'd like to use the data like this (for readability):
int x = lutBounds[3].min;
Is my code below considered 'good practice'? If not, why, and what would be better. I'm completely self-taught in Java but try to use 'best practices' when I can recognize them.
/**
* LUTBounds holds a band datum for the upper and lower bounds of interest.
* @author programmer
*
*/
static class LUTBounds {
final int min;
final int max;
LUTBounds(final int min, final int max) {
this.min = min;
this.max = max;
}
}
// usage: int x = lutBounds[3].min;
final static LUTBounds[] lutBounds = { new LUTBounds(14_123, 30_123),
new LUTBounds(14_922, 40_123), new LUTBounds(14_815, 41_123),
new LUTBounds(14_300, 40_123) };