/** @param args */
  public static void main(String[] args) {
    // TODO Auto-generated method stub
    Scanner input = new Scanner(System.in);
    int times = Integer.parseInt(input.next());
    for (int x = 0; x < times; x++) {
      String next = input.next();
      int pos = (next.length() - 1) / 2;
      String res = "";
      StringBuilder build = new StringBuilder(next);
      String middle = "";
      if (next.length() % 2 == 0) {
        boolean carry = false;

        for (; pos >= 0; pos--) {
          int left = Character.getNumericValue(build.charAt(pos));
          int right = Character.getNumericValue(build.charAt(build.length() - 1 - pos));
          if (left < right) {
            left++;
            build.setCharAt(pos, Character.forDigit(left, 10));
            break;
          } else {

          }
        }
      } else {

      }

      System.out.println(res);
    }
  }
  private List<ExpressionAtom> parseInputPolynomial(String inputExpression) {
    inputExpression = identifyUnaryMinuses(inputExpression);
    inputExpression = insertMultiplicationSigns(inputExpression);

    List<ExpressionAtom> inputExpressionTokens = new ArrayList<ExpressionAtom>();

    char[] inputChars = inputExpression.toCharArray();
    for (int i = 0; i < inputChars.length; ++i) {
      if (isOperator(inputChars[i]) || inputChars[i] == '%') {
        inputExpressionTokens.add(
            new ExpressionAtom(String.valueOf(inputChars[i]), AtomType.OPERATOR, 1));
      } else {
        int lastIndex = inputExpressionTokens.size() - 1;
        if (lastIndex >= 0
            && inputExpressionTokens.get(lastIndex).getAtomType() == AtomType.OPERAND) {
          ExpressionAtom lastElement = inputExpressionTokens.remove(lastIndex);
          if (Character.isDigit(inputChars[i])) {
            lastElement.setCoefficient(
                lastElement.getCoefficient() * 10 + Character.getNumericValue(inputChars[i]));
          } else {
            lastElement.setVariablesOrOperator(
                lastElement.getVariablesOrOperator() + String.valueOf(inputChars[i]));
          }
          inputExpressionTokens.add(lastElement);
        } else if (Character.isDigit(inputChars[i])) {
          inputExpressionTokens.add(
              new ExpressionAtom("", AtomType.OPERAND, Character.getNumericValue(inputChars[i])));
        } else {
          inputExpressionTokens.add(
              new ExpressionAtom(String.valueOf(inputChars[i]), AtomType.OPERAND, 1));
        }
      }
    }
    return inputExpressionTokens;
  }
  public static void main(String[] args) {
    int b, c;
    String a;
    boolean check = false;

    out.print("Insira um número que não esteja em base decimal: ");
    a = sc.next();

    out.print("\nAgora insira a base em que o número se encontra (entre 2 e 10): ");
    b = sc.nextInt();

    for (int i = 0; i < a.length(); i++) {
      if (Character.getNumericValue(a.charAt(i)) >= b) check = true;
    }

    while (b < 2 || b > 10 || check) {
      out.print("\nEntrada inválida.");
      out.print("\nInsira um número que não esteja em base decimal: ");
      a = sc.next();

      out.print("\nAgora insira a base em que o número se encontra (entre 2 e 10): ");
      b = sc.nextInt();

      for (int i = 0; i < a.length(); i++) {
        if (Character.getNumericValue(a.charAt(i)) >= b) check = true;
        else check = false;
      }
    }
    c = basetoNum(a, b);
    out.print("\nO seu número em base decimal é " + c + ".");
  }
  public String multiply(String num1, String num2) {
    if (num1 == null || num2 == null) return null;

    int len1 = num1.length(), len2 = num2.length();
    int len3 = len1 + len2;
    int[] num3 = new int[len3];
    int i, j, carry, digit = 10;

    for (i = len1 - 1; i >= 0; i--) {
      carry = 0;
      for (j = len2 - 1; j >= 0; j--) {
        int a =
            carry
                + num3[i + j + 1]
                + Character.getNumericValue(num1.charAt(i))
                    * Character.getNumericValue(num2.charAt(j));
        carry = a / digit;
        num3[i + j + 1] = a % digit;
      }
      num3[i + j + 1] = carry;
    }

    String S = "";
    i = 0;
    while (i < len3 - 1 && num3[i] == 0) {
      i++;
    }
    while (i < len3) {
      S += Integer.toString(num3[i]);
      i++;
    }
    return S;
  }
  public void BitwiseAnd(String p, String q) {
    int arrayLength = p.length();
    bitwiseArrayA = new int[arrayLength];
    bitwiseArrayB = new int[arrayLength];
    bitwiseResult = new int[arrayLength]; // either p or q works
    for (int i = 0; i < arrayLength; i++) {
      bitwiseArrayA[i] = Character.getNumericValue(p.charAt(i));
      bitwiseArrayB[i] = Character.getNumericValue(q.charAt(i));
    }

    for (int i = arrayLength - 1; i >= 0; i--) {
      if ((bitwiseArrayA[i] == 1) && (bitwiseArrayB[i]) == 1) {
        bitwiseResult[i] = 1;
      } else {
        bitwiseResult[i] = 0;
      }
    }

    System.out.println("Bitwise AND");
    System.out.println("  p		|    q			|	p ^ q");
    System.out.println("-----------------------------------------");
    String result = "";
    for (int i = 0; i < bitwiseResult.length; i++) {
      result += bitwiseResult[i];
    }
    System.out.println(p + "	|   " + q + "		|	" + result);
    System.out.println();
  }
Beispiel #6
0
  /**
   * XXXXXX - XXXXXXX 형식의 법인번호 앞, 뒤 문자열 2개 입력 받아 유효한 법인번호인지 검사.
   *
   * @param 6자리 법인앞번호 문자열 , 7자리 법인뒷번호 문자열
   * @return 유효한 법인번호인지 여부 (True/False)
   */
  public static boolean checkBubinNumber(String bubin1, String bubin2) {

    String bubinNumber = bubin1 + bubin2;

    int hap = 0;
    int temp = 1; // 유효검증식에 사용하기 위한 변수

    if (bubinNumber.length() != 13) return false; // 법인번호의 자리수가 맞는 지를 확인    	

    for (int i = 0; i < 13; i++) {
      if (bubinNumber.charAt(i) < '0' || bubinNumber.charAt(i) > '9') // 숫자가 아닌 값이 들어왔는지를 확인
      return false;
    }

    // 2012.02.27  법인번호 체크로직 수정( i<13 -> i<12 )
    // 맨끝 자리 수는 전산시스템으로 오류를 검증하기 위해 부여되는 검증번호임
    for (int i = 0; i < 12; i++) {
      if (temp == 3) temp = 1;
      hap = hap + (Character.getNumericValue(bubinNumber.charAt(i)) * temp);
      temp++;
    } // 검증을 위한 식의 계산

    if ((10 - (hap % 10)) % 10
        == Character.getNumericValue(bubinNumber.charAt(12))) // 마지막 유효숫자와 검증식을 통한 값의 비교
    return true;
    else return false;
  }
Beispiel #7
0
 /**
  * @param number1
  * @param number2
  * @return
  */
 public static String addNums(String number1, String number2) {
   char[] num1char = number1.toCharArray();
   char[] num2char = number2.toCharArray();
   if (num1char.length > num2char.length) {
     num2char = formatLength(num1char, num2char);
   } else if (num1char.length < num2char.length) {
     num1char = formatLength(num2char, num1char);
   }
   final char[] addition = new char[num1char.length + 1];
   char carry = '0';
   for (int i = num1char.length - 1; i >= 0; i--) {
     int sum =
         Character.getNumericValue(num1char[i])
             + Character.getNumericValue(num2char[i])
             + Character.getNumericValue(carry);
     char[] csum = String.valueOf(sum).toCharArray();
     carry = '0';
     if (csum.length > 1 && i == 0) {
       addition[i + 1] = csum[1];
       addition[0] = csum[0];
     } else if (csum.length > 1) {
       carry = csum[0];
       addition[i + 1] = csum[1];
     } else {
       addition[i + 1] = csum[0];
     }
   }
   return String.valueOf(addition);
 }
Beispiel #8
0
  public int solution(String S) {

    BigInteger mod = new BigInteger("1410000017");
    int numberOf0inDecRep = 0;
    BigInteger N = BigInteger.ZERO;
    BigInteger tot = BigInteger.ZERO;
    for (int j = 0; j < S.length(); j++) {
      tot =
          tot.multiply(BigInteger.valueOf(10))
              .add(mod)
              .add(N)
              .subtract(
                  BigInteger.valueOf(
                      numberOf0inDecRep * (9 - Character.getNumericValue(S.charAt(j)))))
              .mod(mod);
      if (S.charAt(j) == '0') {
        numberOf0inDecRep += 1;
      }
      N =
          N.multiply(BigInteger.valueOf(10))
              .add(BigInteger.valueOf(Character.getNumericValue(S.charAt(j))))
              .mod(mod);
    }
    return tot.add(BigInteger.ONE).mod(mod).intValue();
  }
  @Override
  public void convertString(UTF8StringPointable stringp, DataOutput dOut)
      throws SystemException, IOException {
    ICharacterIterator charIterator = new UTF8StringCharacterIterator(stringp);
    charIterator.reset();
    long value = 0;
    int c = 0;
    boolean negative = false;
    long limit = -Integer.MAX_VALUE;

    // Check the first character.
    c = charIterator.next();
    if (c == Character.valueOf('-') && negativeAllowed) {
      negative = true;
      c = charIterator.next();
      limit = Integer.MIN_VALUE;
    }

    // Read the numeric value.
    do {
      if (Character.isDigit(c)) {
        if (value < limit + Character.getNumericValue(c)) {
          throw new SystemException(ErrorCode.FORG0001);
        }
        value = value * 10 - Character.getNumericValue(c);
      } else {
        throw new SystemException(ErrorCode.FORG0001);
      }
    } while ((c = charIterator.next()) != ICharacterIterator.EOS_CHAR);

    dOut.write(returnTag);
    dOut.writeInt((int) (negative ? value : -value));
  }
  public static int BoardPossibility(
      String a,
      String b,
      String c,
      char length1,
      char length2,
      char length3,
      char[]
          crossovers) { // look at a certain combination of number strings, find total sum (for
                        // later comparison)
    int answer = 0;
    char[] ac = PotentialLine(a, length1, crossovers, 1);
    char[] bc = PotentialLine(b, length2, crossovers, 2);
    char[] cc = PotentialLine(c, length3, crossovers, 3);

    for (int i = 0; i < ac.length; i++) {
      answer = answer + Character.getNumericValue(ac[i]);
    }
    for (int i = 0; i < bc.length; i++) {
      answer = answer + Character.getNumericValue(bc[i]);
    }
    for (int i = 0; i < cc.length; i++) {
      answer = answer + Character.getNumericValue(cc[i]);
    }
    return answer;
  }
Beispiel #11
0
  /**
   * XXX - XX - XXXXX 형식의 사업자번호 앞,중간, 뒤 문자열 3개 입력 받아 유효한 사업자번호인지 검사.
   *
   * @param 3자리 사업자앞번호 문자열 , 2자리 사업자중간번호 문자열, 5자리 사업자뒷번호 문자열
   * @return 유효한 사업자번호인지 여부 (True/False)
   */
  public static boolean checkCompNumber(String comp1, String comp2, String comp3) {

    String compNumber = comp1 + comp2 + comp3;

    int hap = 0;
    int temp = 0;
    int check[] = {1, 3, 7, 1, 3, 7, 1, 3, 5}; // 사업자번호 유효성 체크 필요한 수

    if (compNumber.length() != 10) // 사업자번호의 길이가 맞는지를 확인한다.
    return false;

    for (int i = 0; i < 9; i++) {
      if (compNumber.charAt(i) < '0' || compNumber.charAt(i) > '9') // 숫자가 아닌 값이 들어왔는지를 확인한다.
      return false;

      hap = hap + (Character.getNumericValue(compNumber.charAt(i)) * check[temp]); // 검증식 적용
      temp++;
    }

    hap += (Character.getNumericValue(compNumber.charAt(8)) * 5) / 10;

    if ((10 - (hap % 10)) % 10
        == Character.getNumericValue(compNumber.charAt(9))) // 마지막 유효숫자와 검증식을 통한 값의 비교
    return true;
    else return false;
  }
  public void readTrunk() {
    String filename = "trunk.txt";
    trunk = new Trunk();
    int count = 0;
    int[] buffer = new int[64]; // 16 cards per deck

    try {
      InputStreamReader inputStreamReader =
          new InputStreamReader(getActivity().openFileInput(filename));
      int data = inputStreamReader.read();
      char c = (char) data;
      int num = Character.getNumericValue(c);
      if (data != -1) {
        while (data != -1) {
          buffer[count] = num;
          count++;
          if (count % 4 == 0) {
            trunk.add(
                new Card(
                    buffer[count - 4], buffer[count - 3], buffer[count - 2], buffer[count - 1]));
          }
          data = inputStreamReader.read();
          c = (char) data;
          num = Character.getNumericValue(c);
        }
      }
      inputStreamReader.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #13
0
 public String directionWall(String[][] fieldPlace, String coordXY) {
   ArrayList<String> wayDirection = new ArrayList<String>();
   String way = null;
   Random rand = new Random();
   int x = Character.getNumericValue(coordXY.charAt(0));
   int y = Character.getNumericValue(coordXY.charAt(1));
   String ship = "o";
   int shipSize = shipSize(shipType(3));
   for (int i = x; i < shipSize; i++) {
     for (int j = 0; j < shipSize; j++) {
       if (j == 0
           && i > 0
           && i < shipSize
           && fieldPlace[i + 1][j] != ship
           && fieldPlace[i - 1][j] != ship
           && fieldPlace[i][y + 1] != ship) {
         wayDirection.add("right");
         wayDirection.add("down");
         wayDirection.add("up");
         way = wayDirection.get(rand.nextInt(wayDirection.size()));
         fieldPlace[i][j] = ship;
         wayDirection.clear();
       } else if (j == 0 && i > 0 && i < shipSize && fieldPlace[i + 1][j] != ship) {
         way = "down"; // i = i+1, j= 0
       } else if (j == 0 && i > 0 && i < shipSize && fieldPlace[i - 1][j] != ship) {
         way = "up"; // i =i-1, j= 0
       } else if (j == 0 && i > 0 && i < shipSize && fieldPlace[i][y + 1] != ship) {
         way = "right"; // i>0, j= j+1
       }
     }
   }
   return way;
 }
 private static boolean pawnTwoUp(String move) {
   if ((move.charAt(1) == (move.charAt(3)))
       && (Character.getNumericValue(move.charAt(2)) - Character.getNumericValue(move.charAt(0))
           == 2)) {
     return true;
   } else {
     return false;
   }
 }
Beispiel #15
0
  static {
    // Calculate derived values
    String[] splitMapping = MAPPING.split(" ");

    TASKS = splitMapping.length;
    MAPPING_X = new int[TASKS];
    MAPPING_Y = new int[TASKS];

    for (int i = 0; i < TASKS; i++) {
      MAPPING_X[i] = Character.getNumericValue(splitMapping[i].charAt(0));
      MAPPING_Y[i] = Character.getNumericValue(splitMapping[i].charAt(1));
    }
  }
  private static ArrayList<Integer> createIntArray(String[] hits) {
    ArrayList<Integer> intHits = new ArrayList<Integer>();
    for (String hit : hits) {
      for (int j = 0; j < hit.length(); j++) {
        if (hit.charAt(j) == 'x') intHits.add(10);
        else if (hit.charAt(j) == '/')
          intHits.add(10 - Character.getNumericValue(hit.charAt(j - 1)));
        else intHits.add(Character.getNumericValue(hit.charAt(j)));
      }
    }

    return intHits;
  }
  public static String InWord(Number number) {
    if (number == null) {
      throw new NullPointerException("number must be not null");
    }
    if (number.intValue() > 1000) {
      throw new IllegalArgumentException("number must be less or equal " + "to 1000");
    }

    if (number.intValue() < 0) {
      throw new IllegalArgumentException("number must be greater than 0");
    }

    if (number.intValue() == 0) {
      return NULL;
    }

    String stringNumber = number.toString();
    int digit = stringNumber.length();

    String result = null;
    String word = null;

    for (int i = 0; i < digit; i++) {

      int numeral = Character.getNumericValue(stringNumber.charAt(i));
      int numeralDigit = digit - i;

      if ((numeralDigit == 2) && (numeral == 1)) {
        i++;
        numeral = Character.getNumericValue(stringNumber.charAt(i));
        word = TEENNUMBER[numeral];
      } else {
        word = convertToWord(numeral, numeralDigit);
      }

      if (word != null) {
        if (word.length() > 0) {
          if (result == null) {
            result = word;
          } else {
            result += " " + word;
          }
        }
      }
    }

    return result;
  }
Beispiel #18
0
  public Sequence(File song, int resolution) throws IOException {
    lines.add(0, highHats);
    lines.add(1, bassDrums);
    lines.add(2, snareDrums);
    lines.add(3, floorToms);
    lines.add(4, lowToms);
    lines.add(5, highToms);
    lines.add(6, crashCymbals);
    lines.add(7, rideCymbals);

    this.resolution = resolution;
    Scanner scanner = new Scanner(song);

    char[] line;
    Strike[] strikes = new Strike[resolution];
    int lineNumber = 0;
    while (scanner.hasNextLine()) {

      line = scanner.nextLine().toCharArray();
      for (int i = 0; i < line.length; i++) {
        strikes[i] = new Strike(Character.getNumericValue(line[i]));
      }
      lines.get(lineNumber).addAll(Arrays.asList(strikes));
      lineNumber++;
    }
  }
Beispiel #19
0
 // convert a binary string
 public static int binNum(String s) {
   int sum = 0;
   for (int i = 0; i < s.length(); ++i) {
     sum += Math.pow(2, i) * Character.getNumericValue(s.charAt(s.length() - i - 1));
   }
   return sum;
 }
Beispiel #20
0
  private void loadMap(String filename) throws IOException {
    ArrayList lines = new ArrayList();
    int width = 0;
    int height = 0;

    BufferedReader reader = new BufferedReader(new FileReader(filename));
    while (true) {
      String line = reader.readLine();
      if (line == null) {
        reader.close();
        break;
      }
      if (!line.startsWith("!")) {
        lines.add(line);
        width = Math.max(width, line.length());
      }
    }
    height = lines.size();
    for (int j = 0; j < 12; j++) {
      String line = (String) lines.get(j);
      for (int i = 0; i < width; i++) {
        // System.out.println("(" + i + ", " + j + ") = " + ch);
        if (i < line.length()) {
          char ch = line.charAt(i);
          Tile t = new Tile(i, j, Character.getNumericValue(ch));
          System.out.println("(" + i + ", " + j + ") = " + ch);
          tilearray.add(t);
        }
      }
    }
  }
Beispiel #21
0
  public static Packet<String> decodePacket(String data, boolean utf8decode) {
    int type;
    try {
      type = Character.getNumericValue(data.charAt(0));
    } catch (IndexOutOfBoundsException e) {
      type = -1;
    }

    if (utf8decode) {
      try {
        data = UTF8.decode(data);
      } catch (UTF8Exception e) {
        return err;
      }
    }

    if (type < 0 || type >= packetslist.size()) {
      return err;
    }

    if (data.length() > 1) {
      return new Packet<String>(packetslist.get(type), data.substring(1));
    } else {
      return new Packet<String>(packetslist.get(type));
    }
  }
 public String SNumtoSLetters(String nums) {
   String s = "";
   for (int i = 0; i < nums.length(); i++) {
     s = s + this.LtoString(Character.getNumericValue(nums.charAt(i)));
   }
   return s;
 }
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    System.out.println("Enter credit card number without spaces: ");
    String codeString = sc.nextLine();
    System.out.println();

    char[] codeChar = codeString.toCharArray();
    int[] number = new int[codeChar.length];
    for (int i = 0; i < codeChar.length; i++) {
      number[i] = Character.getNumericValue(codeChar[i]);
    }
    int sum = 0;

    for (int i = 0; i < 16; i += 2) {
      number[i] = number[i] * 2;
      if (number[i] >= 10) {
        sum += 1 + number[i] % 10;
      } else {
        sum += number[i];
      }
      sum += number[i + 1];
    }
    if (sum % 10 == 0) System.out.println("Code is valid");
    else System.out.println("Code is invalid");
  }
Beispiel #24
0
	// construct a zip code given a numeric zip number
	public Zipcode(int zip_number) {
		String zip = Integer.toString(zip_number);

		// checks inputed zip code validity
		if (valid_zip_length(zip)) {
			this.zipcode = zip;

			// determine check digit
			int sum = 0;
			for (int i = 0; i < zip.length(); i++) {
				sum += Character.getNumericValue(zip.charAt(i));
			}
			int check_digit;
			if (sum % 10 == 0)
				check_digit = 0;
			else
				check_digit = 10 - (sum % 10);

			// add check digit to zip code
			zip += Integer.toString(check_digit);

			// convert numbers to bar code
			zip = Num2Bar(zip);

			// add frame bars
			zip = "|" + zip + "|";

			this.barcode = zip;

		} else {
			this.zipcode = "Invalid zip code";
			this.barcode = "Invalid zip code";
		}

	}
 public long getID() {
   long estID = 0;
   // get a numeral from the player's name & world
   for (int j = 0; j < name.length(); j++) {
     char c = name.charAt(j);
     estID += Character.getNumericValue(c);
   }
   for (int j = 0; j < world.length(); j++) {
     char c = world.charAt(j);
     estID += Character.getNumericValue(c);
   }
   estID = estID + x1 + x2 + y1 + y2 + z1 + z2;
   estID = estID + x1 * x2 + y1 * y2 + z1 * z2;
   // tekkitrestrict.log.info("estID: "+estID);
   return estID;
 }
  @Override
  public boolean incrementToken() throws IOException {
    if (input.incrementToken()) {
      char buffer[] = termAtt.buffer();
      int length = termAtt.length();

      for (int i = 0; i < length; i++) {
        int ch = Character.codePointAt(buffer, i, length);
        // look for digits outside of basic latin
        if (ch > 0x7F && Character.isDigit(ch)) {
          // replace with equivalent basic latin digit
          buffer[i] = (char) ('0' + Character.getNumericValue(ch));
          // if the original was supplementary, shrink the string
          if (ch > 0xFFFF) {
            length = StemmerUtil.delete(buffer, i + 1, length);
            termAtt.setLength(length);
          }
        }
      }

      return true;
    } else {
      return false;
    }
  }
Beispiel #27
0
  /** function to evaluate tree */
  public double evaluate(Node ptr) {
    if (ptr.leftChild == null && ptr.rightChild == null) return Character.getNumericValue(ptr.data);
    else {
      double result = 0.0;
      double left = evaluate(ptr.leftChild);
      double right = evaluate(ptr.rightChild);
      char operator = ptr.data;

      switch (operator) {
        case '+':
          result = left + right;
          break;
        case '-':
          result = left - right;
          break;
        case '*':
          result = left * right;
          break;
        case '/':
          result = left / right;
          break;
        default:
          result = left + right;
          break;
      }
      return result;
    }
  }
Beispiel #28
0
  boolean checkCreditCardNumber(String creditCardNumber) {

    boolean checksOut = false;
    if (this.hasCreditCard == true && creditCardNumber.length() == 15) {

      for (int index = 0; index < creditCardNumber.length(); index++) {

        char everyPartOfTheNumber = creditCardNumber.charAt(index);
        int everyNumberOfTheNumber = Character.getNumericValue(everyPartOfTheNumber);

        if (everyNumberOfTheNumber < 0 || everyNumberOfTheNumber > 9) {
          System.out.println("Invalid Number!");
          checksOut = false;
          break;
        } else {
          checksOut = true;
        }
      }
    }
    if (checksOut == true) {
      return true;
    } else {
      return false;
    }
  }
Beispiel #29
0
 private Integer convertHexadecimalToDecimal(String hex) {
   Integer decimal = 0, t;
   String temp = hex;
   Character d;
   for (Integer i = temp.length() - 1; i >= 0; i--) {
     d = temp.charAt(temp.length() - i - 1);
     if (d == 'A') {
       t = 10;
     } else if (d == 'B') {
       t = 11;
     } else if (d == 'C') {
       t = 12;
     } else if (d == 'D') {
       t = 13;
     } else if (d == 'E') {
       t = 14;
     } else if (d == 'F') {
       t = 15;
     } else {
       t = Character.getNumericValue(d);
     }
     Double db = t * (Math.pow(16, i));
     decimal += db.intValue();
   }
   return decimal;
 }
  @Override
  public Object visit(IntegerUnaryExpression n, Void arg) {

    Long longObject = (Long) n.getOperand().accept(this, null);

    long leftVal = longObject.longValue();

    Operator op = n.getOperator();
    switch (op) {
      case NEG:
        return -leftVal;
      case ABS:
        return Math.abs(leftVal);
      case GETNUMERICVALUE:
        return (long) Character.getNumericValue((char) leftVal);
      case ISLETTER:
        return Character.isLetter((char) leftVal) ? TRUE_VALUE : FALSE_VALUE;
      case ISDIGIT:
        return Character.isDigit((char) leftVal) ? TRUE_VALUE : FALSE_VALUE;

      default:
        log.warn("IntegerUnaryExpression: unimplemented operator: " + op);
        return null;
    }
  }