class ALU {

	public String oneAdder (String operand) {
		
		if (operand.indexOf("0")==-1){
			return ALU.repeatedString("0", operand.length()+1);
		}
		
		char rightmostBit = charOp(booleanXOR, operand.charAt(operand.length()-1), '1');
		char carry = operand.charAt(operand.length()-1);
		
		StringBuilder result = new StringBuilder(String.valueOf(rightmostBit));
		
		for(int i=operand.length()-2;i>=0;i--){
			result.append(charOp(booleanXOR, operand.charAt(i), carry));
			carry = charOp(booleanAnd, operand.charAt(i), carry);
		}
		
		
		boolean isOverflow = charOp(booleanXOR, operand.charAt(0), result.charAt(result.length()-1)) == '1';
		
		result.append(isOverflow?"1":"0");
		
		result.reverse();
		return result.toString();
	}

}