private String getBinaryFromBase(String valueAndBase) throws AssemblerException{
		
		char base = valueAndBase.charAt(valueAndBase.length() - 1);
		String value = valueAndBase.substring(0, valueAndBase.length() - 1);

		// Binary
		if (base == 'B') {
			if (value.isEmpty())
				throw new AssemblerException(
						"Value error: Syntax error, <value><B/H/I> expected.\n"
								+ "Binary value missing.");
			if (!isBinary(value))
				throw new AssemblerException("Value error: \"" + value
						+ "\" is not a valid binary value.");
		}

		// Hex
		else if (base == 'H') {
			if (value.isEmpty())
				throw new AssemblerException(
						"Value error: Syntax error, <value><B/H/I> expected.\n"
								+ "Hex value missing.");

			try {				
				value = Assembler.hexToBinary(value);				
			} catch (NumberFormatException e) {				
				throw new AssemblerException("Value error: \"" + value
						+ "\" is not a valid hex value.");
			}
		}

		// Integer
		else if (base == 'I') {
			if (value.isEmpty())
				throw new AssemblerException(
						"Value error: Syntax error, <value><B/H/I> expected.\n"
								+ "Integer value missing.");

			try {				
				value = Assembler.intToBinary(value);				
			} catch (NumberFormatException e) {				
				throw new AssemblerException("Value error: \"" + value
						+ "\" is not a valid integer.");
			}
		}

		else
			throw new AssemblerException(
					"Value error: Syntax error, <value><B/H/I> expected.\n"
							+ "Last character of second string (\""
							+ valueAndBase
							+ "\") should indicate data type (\"B\", \"H\" or \"I\")." 
							+ "\nB indicates value is binary, H indicates hexadecimal and I indicates integer.");
		
		return value;
	}