[RESOLVED] 2D Array

Well I have implemented this in my code:

byte arrayRead(byte array, byte first, byte second) {
  if(array == 1) {
    return (values[(int)first / 8][second] & (1 << (first % 8))) >> first;
  }
  else if(array == 2) {
    return (nextValues[(int)first / 8][second] & (1 << (first % 8))) >> first;
  }
}

void arrayWrite(byte array, byte first, byte second, byte data) {
  if(array == 1) {
    values[(int)first / 8][second] |= (data << (first % 8));
  }
  else if(array == 2) {
    nextValues[(int)first / 8][second] |= (data << (first % 8));
  }
}

And is that what I should be doing? Because it is not working...