Arduino uno writeshort bytecode and readshort bytecode?

Hi I am trying to read and write short bytecode in arduino uno, basically I made a program in as3 and what I would do to readshort was to set the bytearray at a certain position like ba.position=4 and than use readshort to get the short at position 4, I even made the program in as3 so that it can read and write bits by using certain numbers in a short as hooks.

basically I need readshort function and write short function and byte array to add the bytes to.

heres my as3 version:

var actionStorage={ba:ByteArray,pattern:[0,0,0,1,1,1,2,2,2,3,3,3],hexLib:[null,"111","222","211","112","121","212","221","122"],map_size:250,temp_reg:"",temp_bit:"",ba_old:"",bitConvertor:[0,1,2,3,4,5,6,7,8,9,10,11],found_bin:"",bit_0:"",bit_1:"",bit_2:"",bit_3:"",bit_4:"",bit_5:"",bit_6:"",bit_7:"",bit_8:"",bit_9:"",bit_10:"",bit_11:"",error_msg:[trace,"error: max range for x and y is 0-3000","Error: flip states can only be 0 or 1, you used something else"]};
actionStorage.ba=new ByteArray();

for(var i=0;i<int(int(actionStorage.map_size)+1)*int(int(actionStorage.map_size)+1);i++){
actionStorage.ba.writeShort(2222);
}
actionStorage.ba.deflate();


function getBit(temp_x,temp_y){
if(temp_x<3001&&temp_x>-1&&temp_y<3001&&temp_y>-1){
actionStorage.ba.inflate();
if(temp_y>0){
actionStorage.ba.position =int(temp_x) +  ((int(temp_y)*actionStorage.map_size))
}else{
actionStorage.ba.position =int(temp_x) +   ((int(temp_y)*actionStorage.map_size))    
}
actionStorage.ba_old=actionStorage.ba.position
actionStorage.temp_reg= (actionStorage.ba.position/12)+".0";
actionStorage.temp_reg=actionStorage.temp_reg.split(".")[0]
actionStorage.ba.position=actionStorage.temp_reg*2;
actionStorage.found_bin=actionStorage.ba.readShort().toString();
actionStorage.ba.deflate();
for(i=0;i<12;i++){
actionStorage["bit_"+i]=actionStorage.hexLib[actionStorage.found_bin.charAt(actionStorage.pattern[i])].charAt(i%3);
}
return(actionStorage["bit_"+actionStorage.bitConvertor[actionStorage.ba_old%12]]-1);
}else{
actionStorage.error_msg[0](actionStorage.error_msg[1])
}
}


function setBit(temp_x,temp_y,flip_state){;
if(flip_state==0||flip_state==1){
actionStorage.ba.inflate()
flip_state++;
if(temp_y>0){
actionStorage.ba.position =int(temp_x) +  ((int(temp_y)*actionStorage.map_size))
}else{
actionStorage.ba.position =int(temp_x) +   ((int(temp_y)*actionStorage.map_size))    
}
actionStorage.ba_old=actionStorage.ba.position
actionStorage.temp_reg= (actionStorage.ba.position/12)+".0";
actionStorage.temp_reg=actionStorage.temp_reg.split(".")[0]
actionStorage.ba.position=actionStorage.temp_reg*2;
actionStorage.found_bin=actionStorage.ba.readShort().toString();
actionStorage.ba.position-=2;
for(i=0;i<12;i++){
actionStorage["bit_"+i]=actionStorage.hexLib[actionStorage.found_bin.charAt(actionStorage.pattern[i])].charAt(i%3);
}
actionStorage["bit_"+actionStorage.bitConvertor[actionStorage.ba_old%12]]=flip_state;
actionStorage.ba.writeShort(int(actionStorage.hexLib.indexOf(actionStorage.bit_0+actionStorage.bit_1+actionStorage.bit_2).toString()+actionStorage.hexLib.indexOf(actionStorage.bit_3+actionStorage.bit_4+actionStorage.bit_5).toString()+actionStorage.hexLib.indexOf(actionStorage.bit_6+actionStorage.bit_7+actionStorage.bit_8).toString()+actionStorage.hexLib.indexOf(actionStorage.bit_9+actionStorage.bit_10+actionStorage.bit_11).toString()));
actionStorage.ba.deflate();
}else{
actionStorage.error_msg[0](actionStorage.error_msg[2])
}
}

setBit(0,0,0);  
trace(getBit(0,0));