question: private static int countDuplicates ( StackTraceElement [ ] currentStack , StackTraceElement [ ] parentStack ) { int duplicates = 0 ; int parentIndex = parentStack . length ; for ( int i = currentStack . length ; -- i >= 0 && -- parentIndex >= 0 ; ) { StackTraceElement parentFrame = parentStack [ parentIndex ] ; if ( parentFrame . equals ( currentStack [ i ] ) ) { duplicates ++ ; } else { break ; } } return duplicates ; }
target:  Count the number of duplicate stack frames, starting from the end of the stack.