Question: I'm porting some C++ code to Actionscript 3 and just had a small question I'm confused about.

In one function, one of the parameters is `int* myPtr`. myPtr is the address of an element of a 2D-Array, `&my2DArray[x][y]`. x and y are also parameters of the function. I'm just a little bit confused with what is being accessed when the code accesses, for example, `myPtr[1]`. I think this would be the next element in `my2dArray`, but I'm not sure if this would be `my2DArray[x+1][y]` or `my2DArray[x][y+1]`. Thanks for any help.

Additional info:
my2DArray is created by: 

```
//initPtr is a int*, auxPtr is a int*, as is temp1
initPtr = (unsigned int *)NewPtr(
      sizeof(unsigned int) *
      X * Y);
  }

  auxPtr = initPtr ;

  for (i = 0; i < X; i++) {
    temp1 = auxPtr + i * Y;
    my2DArray[i] = (short *)temp1;
  } 

unsigned char* NewPtr(
  int size)
{
  return ((unsigned char*)calloc(size, sizeof(unsigned char)));
}

```

Answer: 
Use [`Integer.parseInt(String, int radix)`](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#parseInt%28java.lang.String,%20int%29).

```
 public static String addBinary(){
 // The two input Strings, containing the binary representation of the two values:
    String input0 = "1010";
    String input1 = "10";

    // Use as radix 2 because it's binary    
    int number0 = Integer.parseInt(input0, 2);
    int number1 = Integer.parseInt(input1, 2);

    int sum = number0 + number1;
    return Integer.toBinaryString(sum); //returns the answer as a binary value;
}

```
here's a python version that

```
def binAdd(s1, s2):
    if not s1 or not s2:
        return ''

    maxlen = max(len(s1), len(s2))

    s1 = s1.zfill(maxlen)
    s2 = s2.zfill(maxlen)

    result  = ''
    carry   = 0

    i = maxlen - 1
    while(i >= 0):
        s = int(s1[i]) + int(s2[i])
        if s == 2: #1+1
            if carry == 0:
                carry = 1
                result = "%s%s" % (result, '0')
            else:
                result = "%s%s" % (result, '1')
        elif s == 1: # 1+0
            if carry == 1:
                result = "%s%s" % (result, '0')
            else:
                result = "%s%s" % (result, '1')
        else: # 0+0
            if carry == 1:
                result = "%s%s" % (result, '1')
                carry = 0   
            else:
                result = "%s%s" % (result, '0') 

        i = i - 1;

    if carry>0:
        result = "%s%s" % (result, '1')
    return result[::-1]

```