The following code does work how I need it to, but it\'s ugly, excessive or a number of other things. I\'ve looked at formulas and attempted to write a few solutions, but I
I'd use a Map, either a HashMap or a TreeMap
Especially if the parameters are not on the form 0 <= X < N
Like a set of random positive integers ..
Code
public class MyMap
{
private TreeMap map;
public MyMap ()
{
map = new TreeMap ();
}
public void put (int key1, int key2, Integer value)
{
String key = (key1+":"+key2);
map.put(key, new Integer(value));
}
public Integer get (int key1, int key2)
{
String key = (key1+":"+key2);
return map.get(key);
}
}