public static int[] convertToByteCode(String instructions) {
    if (instructions == null || instructions.trim().length() == 0) {
      return new int[0];
    }

    var splitedInstructions = instructions.trim().split(" ");
    var bytecode = new int[splitedInstructions.length];
    for (var i = 0; i < splitedInstructions.length; i++) {
      if (isValidInstruction(splitedInstructions[i])) {
        bytecode[i] = Instruction.valueOf(splitedInstructions[i]).getIntValue();
      } else if (isValidInt(splitedInstructions[i])) {
        bytecode[i] = Integer.parseInt(splitedInstructions[i]);
      } else {
        var errorMessage = "Invalid instruction or number: " + splitedInstructions[i];
        throw new IllegalArgumentException(errorMessage);
      }
    }

    return bytecode;
  }
@Test
  void testInstructions() {
    var instructions = "LITERAL 35 SET_HEALTH SET_WISDOM SET_AGILITY PLAY_SOUND"
        + " SPAWN_PARTICLES GET_HEALTH ADD DIVIDE";

    var bytecode = InstructionConverterUtil.convertToByteCode(instructions);

    Assertions.assertEquals(10, bytecode.length);
    Assertions.assertEquals(Instruction.LITERAL.getIntValue(), bytecode[0]);
    Assertions.assertEquals(35, bytecode[1]);
    Assertions.assertEquals(Instruction.SET_HEALTH.getIntValue(), bytecode[2]);
    Assertions.assertEquals(Instruction.SET_WISDOM.getIntValue(), bytecode[3]);
    Assertions.assertEquals(Instruction.SET_AGILITY.getIntValue(), bytecode[4]);
    Assertions.assertEquals(Instruction.PLAY_SOUND.getIntValue(), bytecode[5]);
    Assertions.assertEquals(Instruction.SPAWN_PARTICLES.getIntValue(), bytecode[6]);
    Assertions.assertEquals(Instruction.GET_HEALTH.getIntValue(), bytecode[7]);
    Assertions.assertEquals(Instruction.ADD.getIntValue(), bytecode[8]);
    Assertions.assertEquals(Instruction.DIVIDE.getIntValue(), bytecode[9]);
  }