static boolean matchForward ( char [ ] chars , char [ ] pattern , int [ ] cursor ) { if ( pattern . length > cursor [ 1 ] - cursor [ 0 ] ) return false ; int index = 0 ; while ( index < pattern . length ) if ( chars [ cursor [ 0 ] ++ ] != pattern [ index ++ ] ) return false ; return true ; }
Match characters in a forward direction