<awangdev>Cracking the Safe_2.java
private void dfs(int n, int k, double total, Set<String> visited, StringBuffer sb) {

        if (visited.size() == total) return;
        String tail = sb.substring(sb.length() - n + 1);
        for (int j = k - 1; j >= 0; j--) {
            String newStr = tail + j;
            if (visited.contains(newStr)) continue;
            visited.add(newStr);
            sb.append(j);
            dfs(n, k, total, visited, sb);
        }
    }
private void sample_funcname ( int n , int k , double total , Set < String > visited , StringBuffer sb ) {
  if ( visited . size ( ) == total ) return ;
  String tail = sb . substring ( sb . length ( ) - n + 1 ) ;
  for ( int j = k - 1 ;
  j >= 0 ;
  j -- ) {
    String newStr = tail + j ;
    if ( visited . contains ( newStr ) ) continue ;
    visited . add ( newStr ) ;
    sb . append ( j ) ;
    dfs ( n , k , total , visited , sb ) ;
  }
}
