import java.util.Random; import java.io.*; import java.lang.Object; import java.util.*; import seqhoundlib.SeqHound; import slrilib.*; class ex02 { public static void main(String[] args) throws IOException { SeqHound seqhound = new SeqHound(); seqhound.SHoundInit(true, "value"); OutputStream f0=new FileOutputStream("file2.txt",true); Random gen=new Random(); int gi; for(int i=0;i<2000;i++) { float ff= 2000000*gen.nextFloat(); gi=(int) ff; String str=new String(); String s,s1; StringBuffer sb=new StringBuffer(100); if (seqhound.SHoundExists(gi)) { if((str=seqhound.SHoundGetGenBankff(gi))!=null) { int l1=str.indexOf("LOCUS"); int l0=str.indexOf("\n"); int l5=str.indexOf("ACCESSION"); int l6=str.indexOf("\n",l5); int l2=str.indexOf("ORGANISM"); int l3=str.indexOf("\n",l2); s=sb.append(str.substring(l1+5,l0)). append(str.substring(l2+9,l3)). toString(); byte buf[]=s.trim().getBytes(); System.out.println(sb); f0.write(buf); f0.write('\n'); } } } } }