E ai galera fmz???
 
Estou com um problema... Preciso fazer um programa que compare o trio de 3 caracteres em um arquivo .txt, mas n esta rodando... o q pode ser? tem um jeto melhor para fazer isso? Segue o codigo a baixo..
 
Em Applet:
 
import java.io.*;
import java.applet.*;
public class criptoanalise5 extends Applet
 {
   int col=10;  
   int lin=0, l=0;
   int x, f, b;
   int v = 256, q=256, w=256;
   int tudo[][][] = new int [v][q][w];
  
      public void init ()
  {
     
   try {
      FileInputStream t = new FileInputStream("d3.txt");
      
      
     x=t.read();
     f=t.read();
     b=t.read();
     tudo[x][f][b]++;
   
     while (((x=f)!= -1) || ((f=b) != -1) && ((b=t.read())!= -1)){  
       
             tudo[x][f][b]++;
       
     }
 
  t.close();
 
    
   }
     
     catch (IOException e)
    {
    System.exit (0);
    }
  
    }
 public void paint(Graphics g){
  
  for(int k = 0; k < 256; k++){
   for(int z = 0; z < 256; z++){
        for(int j = 0; j< 256; j++){ 
         if ( tudo[j][z][k] >=0)
         {             
            g.setColor(Color.blue);  
            g.drawString((char)j+" "+(char)z+" "+(char)k , col,lin );
           
            g.setColor(Color.black);
            g.drawString("    = ", col+16,lin );
            
            g.setColor(Color.red);
            g.drawString("      "+tudo[j][z][k], col+20,lin );
            
            lin=lin+15;
            l=l+15;
            
            if (l == 600){
      col=90;
      lin=0;}
     
     if (l == 1200){
     col=170;
     lin=0;}
            
     if (l == 1800){
     col=260;
     lin=0;}            
                        
             }
          }}}
         
  }
 public boolean action(Event event, Object arg)
    {
        repaint();
        return true;
    }
}



Yahoo! Mail
Mais espaço, mais segurança e gratuito: caixa postal de 6MB, antivírus, proteção contra spam.

Responder a