🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
1 messages
1 total messages Started by JPluto Tue, 25 May 2004 15:56
I don't find an source of brute force!
#145
Author: JPluto
Date: Tue, 25 May 2004 15:56
44 lines
1982 bytes
Hi All,
I have a problem:
I don't find an source of brute force!
Can we help me?
I have already seen this source:

import java.util.*;

public class BFMatch {

public static void main(String[] args) {

   if(args.length!=2) {
     System.err.println("Usage: java -cp . BFMatch <String> <match>");
     System.exit(1);
   }

   List l = bruteForceMatch(args[0],args[1]);
   Iterator i = l.iterator();
   while(i.hasNext()){
     System.out.println(i.next());
   }

}


public static List bruteForceMatch(String data, String match) {
   // do some valididity checks here

   // create results
   List list = new LinkedList();
   for(int n=0;n<(data.length()-match.length());n++){
     for(int
m=0;(m<match.length())&&(data.charAt(m+n)==match.charAt(m));m++)
       if(m>=match.length()-1) list.add(new Integer(n));
   }
   return list;
}
}


For you is ok?
What is possible that this  source prove all words?
I will prove di source at the earliest!
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads