import java.util.*;

public class Command
{
    public static final String MASK = "mask";
    public static final String MEM = "mem";
    public static final String OPEN_BRACE = "[";
    public static final String CLOSE_BRACE = "]";
    public static final String EQUALS = "=";

    public static final char FLOATING_BIT = 'X';

    public static final int INTEGER_SIZE = 36;

    public Command (String mask, Vector<String> cmds, boolean debug)
    {
        _mask = mask;
        _commands = cmds;
        _debug = debug;
    }

    public void execute (Memory mem)
    {
        String theMask = _mask.substring(_mask.indexOf(EQUALS) +1).trim();

        if (_debug)
            System.out.println("Bitmask is: "+theMask);

        for (int i = 0; i < _commands.size(); i++)
        {
            int startIndex = _commands.elementAt(i).indexOf(OPEN_BRACE);
            int endIndex = _commands.elementAt(i).indexOf(CLOSE_BRACE);
            String addrStr = _commands.elementAt(i).substring(startIndex +1, endIndex);
            Long addr = Long.parseLong(addrStr);

            if (_debug)
                System.out.println("Memory address: "+addr);

            startIndex = _commands.elementAt(i).indexOf(EQUALS);

            String valueStr = _commands.elementAt(i).substring(startIndex +1).trim();
            Long value = Long.parseLong(valueStr);

            if (_debug)
                System.out.println("Value: "+value);

            Vector<String> addresses = applyMask(theMask, addr);
        }
    }

    @Override
    public String toString ()
    {
        String str = _mask;

        for (int i = 0; i < _commands.size(); i++)
        {
            str += "\n" + _commands.elementAt(i);
        }

        return str;
    }

    private Vector<String> applyMask (String mask, long address)
    {
        char[] theMaskArray = mask.toCharArray();
        Vector<String> masks = new Vector<String>();
        int count = 0;

        for (int i = 0; i < theMaskArray.length; i++)
        {
            if (theMaskArray[i] == FLOATING_BIT)
                count++;
        }

        return null;
    }

    private char[] convertToBinary (long value)
    {
        char[] tempBinary = Long.toBinaryString(value).toCharArray();
        char[] binary;

        if (tempBinary.length < INTEGER_SIZE)
        {
            binary = new char[INTEGER_SIZE];

            for (int i = 0; i < (INTEGER_SIZE - tempBinary.length); i++)
            {
                binary[i] = '0';
            }

            for (int j = 0; j < tempBinary.length; j++)
            {
                binary[(INTEGER_SIZE - tempBinary.length) +j] = tempBinary[j];
            }
        }
        else
            binary = tempBinary;

        return binary;
    }

    private String _mask;
    private Vector<String> _commands;
    private boolean _debug;
}
@@ -2101,220 +2101,21 @@
     
-return null;%0A    %7D%0A%0A    private char%5B%5D convertToBinary (long value)%0A    %7B%0A        char%5B%5D tempBinary = Long.toBinaryString(value).toCharArray();%0A        char%5B%5D binary;%0A%0A        if (tempBinary.length %3C INTEGER_SIZE
+if (count %3E 0
 )%0A  
@@ -2138,339 +2138,39 @@
     
-b
 in
-ary = new char%5BINTEGER_SIZE%5D;%0A%0A            for (int i = 0; i %3C (INTEGER_SIZE - tempBinary.length); i++)%0A            %7B%0A                binary%5Bi%5D = '0';%0A            %7D%0A%0A            for (int j = 0; j %3C tempBinary.length; j++)%0A            %7B%0A                binary%5B(INTEGER_SIZE - tempBinary.length) +j%5D = tempBinary%5Bj%5D;%0A            %7D
+t%5B%5D options = new int%5Bcount%5D;
 %0A   
@@ -2205,28 +2205,25 @@
     
-binary = tempBinary;
+masks.add(mask);%0A
 %0A%0A  
@@ -2239,14 +2239,13 @@
 urn 
-binary
+masks
 ;%0A  

Update Command.java