question: @ Contract ( pure = true ) public static boolean startsWithConcatenation ( @ NotNull String string , @ NotNull String ... prefixes ) { int offset = 0 ; for ( String prefix : prefixes ) { int prefixLen = prefix . length ( ) ; if ( ! string . regionMatches ( offset , prefix , 0 , prefixLen ) ) { return false ; } offset += prefixLen ; } return true ; }
target:  Equivalent to string.startsWith(prefixes[0] + prefixes[1] + ...) but avoids creating an object for concatenation.