Naive implementation of DoubleArray in Java