Here is a real case of data structure. Assume that I put tripples of integers in array. And I call them VALUE, NEXT, and PREV. I declare the following constants:
static final int VALUE = 0;
static final int NEXT = 1;
static final int PREV = 2;
static final int COUNT = 3;
and the following methods:
int getValue(int[] a, int i) { return a[i * COUNT + VALUE]);
int getNext(int[] a, int i) { return a[i * COUNT + NEXT]);
int getPrev(int[] a, int i) { return a[i * COUNT + PREV]);
In getValue method IDEA compains that "+ VALUE" expression is pointless, since I'm adding just zero. It should not complain when I add a constant, since in the next version of the code I might change constants and VALUE shall becomes something other than zero.