public static short javaStringToInt(java.lang.String str) {
        StringCharacterIterator i = new StringCharacterIterator(str);
		i.first();
		boolean neg = false;
		if (i.current() == '-') {
			neg = true;
			i.next();
		}
		int value = 0;
		for (;i.current() != CharacterIterator.DONE; i.next()) {
			char c = i.current();
			if (i.current() < '0' || c > '9')
				break;
			value = value*10 + (c-'0');
		}
		if (neg) {
			return (short)-value;
		} else {
			return (short)value;
		}
	}