public Instruction[] getMnemonics(String mnemonic){
        Instruction[] temp = new Instruction[binCode.size()];
        int c = 0;
        for (int j = 0; j < binCode.size(); j++) {
            if (binCode.get(j).getMnemonic().equalsIgnoreCase(mnemonic))
                temp[c++] = binCode.get(j);
        }
        int s = 0;
        for (int j = 0; j < temp.length; j++) {//count number of elements in temp array
            if(temp[j] != null)
                s++;
        }
        Instruction[] i = new Instruction[s];
        for (int j = 0; j < i.length; j++) {//copy populated elements from temp array
            i[j] = temp[j];
        }
        return i;
    }