Advertisement
Guest User

eaaeae

a guest
Mar 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.             int soma = 0;
  2.             int resto = 0;
  3.             int i;
  4.             int j = 10;
  5.  
  6.             if (cpf == "00000000000") {
  7.                
  8.                 System.out.println("Fake News.");
  9.                 this.cpf = "EAE";
  10.                 return;
  11.             }
  12.            
  13.            
  14.                 for (i = 0; i < 9; i++){
  15.                    
  16.                     soma = soma + ((cpf.charAt(i) - 48) * j);
  17.                     j = j - 1;
  18.                
  19.                 }
  20.                
  21.                     resto = (soma * 10) % 11;
  22.                    
  23.                 if (resto == 10 || resto == 1) {
  24.                     resto = 0;
  25.                 }
  26.                
  27.                 if (resto == (cpf.charAt(9) - 48)) {
  28.                
  29.                     soma = 0;
  30.                     j = 11;
  31.                
  32.                
  33.                     for (i = 0; i < 10; i++){
  34.                        
  35.                         soma = soma + ((cpf.charAt(i) - 48) * j);
  36.                         j = j - 1;
  37.                    
  38.                     }
  39.                
  40.                     resto = (soma * 10) % 11;
  41.                
  42.                     if (resto == (cpf.charAt(10) - 48)) {
  43.                        
  44.                         this.cpf = cpf;
  45.                        
  46.                     }
  47.                    
  48.                 }else{
  49.                    
  50.                     this.cpf = "2345meia78";
  51.                 }
  52.  
  53.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement