Program: 51562
Project: 51562
Buggy source:
/** 
 * This method coverts a complete command in a symbolic form to a binary form. caller must split up the original command and give the parts as parameters
 * @param opCode String form of an operation code. (STORE)
 * @param firstRegister String form of a first register. (R0-R7, SP or FP)
 * @param addressingMode = or @ or an empty string that representes the memory addressing mode.
 * @param address String form of an address, must be a valid int.
 * @param otherRegister String form of an other register. (R0-R7, SP or FP)
 * @return Int format of a symbolic opCode. (etc 00000010 00101000 00000000 01100100 as int)
 */
public int stringToBinary(String opcode,String firstRegister,String addressingMode,String address,String otherRegister){
  boolean allOk=true;
  int opcodeAsInt=getOpcode(opcode);
  int firstRegisterAsInt=getRegisterId(firstRegister);
  int addressingModeAsInt=getAddressingMode(addressingMode);
  int addressAsInt=0;
  int secondRegisterIdAsInt=getRegisterId(otherRegister);
  if (address.equals("String_Node_Str"))   address="String_Node_Str";
  try {
    addressAsInt=Integer.parseInt(address);
  }
 catch (  NumberFormatException e) {
    allOk=false;
  }
  if (opcodeAsInt < 0) {
    allOk=false;
  }
  if (firstRegisterAsInt < 0) {
    allOk=false;
  }
  if (addressingModeAsInt < 0) {
    allOk=false;
  }
  if (secondRegisterIdAsInt < 0) {
    allOk=false;
  }
  if (allOk) {
    if (opcodeAsInt == 1 || (opcodeAsInt >= 32 && opcodeAsInt <= 44)) {
      addressingModeAsInt=addressingModeAsInt - 1;
      if (addressingModeAsInt == -1) {
        ++addressingModeAsInt;
      }
    }
    String binary=intToBinary(opcodeAsInt,8) + intToBinary(firstRegisterAsInt,3) + intToBinary(addressingModeAsInt,2)+ intToBinary(secondRegisterIdAsInt,3)+ intToBinary(addressAsInt,16);
    return binaryToInt(binary,true);
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * This method coverts a complete command in a symbolic form to a binary form. caller must split up the original command and give the parts as parameters
 * @param opCode String form of an operation code. (STORE)
 * @param firstRegister String form of a first register. (R0-R7, SP or FP)
 * @param addressingMode = or @ or an empty string that representes the memory addressing mode.
 * @param address String form of an address, must be a valid int.
 * @param otherRegister String form of an other register. (R0-R7, SP or FP)
 * @return Int format of a symbolic opCode. (etc 00000010 00101000 00000000 01100100 as int)
 */
public int stringToBinary(String opcode,String firstRegister,String addressingMode,String address,String otherRegister){
  boolean allOk=true;
  int opcodeAsInt=getOpcode(opcode);
  int firstRegisterAsInt=getRegisterId(firstRegister);
  int addressingModeAsInt=getAddressingMode(addressingMode);
  int addressAsInt=0;
  int secondRegisterIdAsInt=getRegisterId(otherRegister);
  if (address.equals("String_Node_Str"))   address="String_Node_Str";
  try {
    addressAsInt=Integer.parseInt(address);
  }
 catch (  NumberFormatException e) {
    allOk=false;
  }
  if (opcodeAsInt < 0) {
    allOk=false;
  }
  if (firstRegisterAsInt < 0) {
    firstRegisterAsInt=0;
  }
  if (addressingModeAsInt < 0) {
    addressingModeAsInt=1;
  }
  if (secondRegisterIdAsInt < 0) {
    secondRegisterIdAsInt=0;
  }
  if (allOk) {
    if (opcodeAsInt == 1 || (opcodeAsInt >= 32 && opcodeAsInt <= 44)) {
      addressingModeAsInt=addressingModeAsInt - 1;
      if (addressingModeAsInt == -1) {
        ++addressingModeAsInt;
      }
    }
    String binary=intToBinary(opcodeAsInt,8) + intToBinary(firstRegisterAsInt,3) + intToBinary(addressingModeAsInt,2)+ intToBinary(secondRegisterIdAsInt,3)+ intToBinary(addressAsInt,16);
    return binaryToInt(binary,true);
  }
  return -1;
}