就是用java编一个andriod的计算器,其中一个method是把一个string中的数字部分抽出来,literal是那个string, start是这个数字中的第一个数位置。要求是让_end等于数字中的最后一个位置,比方说-3.54,start就应该指向'-',然后_end应该指向5。下面是那个method:
          
         /**
 * Constructs a decimal token from part of a literal
 * 
 * @param literal
 *            the expression to parse a decimal
 * @param start
 *            the position to start parsing
 * @throws ParseException
 *             when the token is not a decimal
 */

        public Decimal(String literal, int start) throws ParseException
{
super(literal, start);
int length =literal.length();
int _end = (this.start = start) + 1;
char c = literal.charAt(start);
// Extracts the position of the decimal
if (c == '+' || c == '-' || c == '.' || c >= '0' && c <= '9')
{
                   _end--;
   do{
_end++;
if(_end==length)
   break;
else
   c=literal.charAt(_end);
     } while (c == '.' || c >= '0' && c <= '9');
        }                       
else
{
throw new ParseException("Decimal expected", start);
}
// Parses the decimal into a 64-bit floating point number
value = Double.parseDouble(literal.substring(start, end = _end));
}
以上是原来的method,现在要把这个Decimal的method改了,用java.util.StringTokenizer.来使得_end指向数字中的最后一个位置,怎么样改呢??谢谢谢谢谢谢十分感谢!我实在是试不出来求帮助!