Guest User

Untitled

a guest
Jun 25th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package zpliku;
  6.  
  7. import java.io.BufferedReader;
  8. import java.io.FileReader;
  9. import java.io.IOException;
  10. import java.util.regex.Matcher;
  11. import java.util.regex.Pattern;
  12.  
  13. /**
  14.  *
  15.  * @author Jaro
  16.  */
  17. public class test2 {
  18.    
  19.     public static void main(String[] args) throws IOException {
  20.        
  21.         FileReader fr=new FileReader("X:/gry/kolos.txt");
  22.         BufferedReader br = new BufferedReader(fr);
  23.         String c;
  24.         Pattern p=Pattern.compile("s");
  25.         Pattern p2=Pattern.compile("f");
  26.        
  27.         while((c=br.readLine())!=null){
  28.             Matcher n=p.matcher(c);
  29.             Matcher m=p2.matcher(c);
  30.            
  31.             if(n.find()){
  32.                 String temp[]=c.split("s");
  33.                
  34.                 for(int i=0;i<temp.length;i++){
  35.                 TestSilnia ts = new TestSilnia(Integer.parseInt(temp[i]));
  36.                 ts.start();
  37.                 }
  38.             }
  39.             if(m.find()){
  40.                 String temp[]=c.split("f");
  41.                 for(int i=0;i<temp.length;i++){
  42.                 TestFibon tf=new TestFibon(Integer.parseInt(temp[i]));
  43.                
  44.                 tf.start();
  45.                 }
  46.             }
  47.         }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment