public String nextToken() {
        if(m_index < 0) {
            m_index = 0;
        }
        if(m_index > m_string.length() - 1) {
            throw new IllegalStateException("StringTokenizer.nextToken() index beyond length of string, no more tokens");
        }

        int tokenLength = 0;
        int nextTokenIndex = -1;
        for (int i = 0; i < m_tokens.length; i++) {
            int tmpIndex = m_string.indexOf(m_tokens[i], m_index);
            if(tmpIndex >= 0 && (nextTokenIndex < 0 || tmpIndex < nextTokenIndex)) {
                nextTokenIndex = tmpIndex;
                tokenLength = m_tokens[i].length();
            }
        }

        if(nextTokenIndex == -1) { //no token found
            nextTokenIndex = m_string.length();
        }

        String nextToken = m_string.substring(m_index, nextTokenIndex);
        m_index = nextTokenIndex + tokenLength;

        return nextToken; 
    }