Advertisement
Nick-O-Rama

FileEncrypter

Mar 18th, 2015
510
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2. import java.io.*;
  3.  
  4. public class FileEncrypter {
  5.    
  6.     public static void main(String[] args) throws IOException
  7.     {
  8.         try
  9.         {
  10.             File myFile = new File("test.txt");
  11.             Scanner input = new Scanner(myFile);
  12.             PrintWriter writer = new PrintWriter("output.txt");
  13.            
  14.             while (input.hasNext())
  15.             {
  16.                 String line = input.nextLine();
  17.                 char[] encrypt = line.toCharArray();
  18.                 for (int i = 0; i < encrypt.length; i++)
  19.                 {
  20.                     encrypt[i] += 10;
  21.                     writer.print(encrypt[i]);
  22.                 }
  23.                 writer.println();
  24.             }
  25.             writer.close();
  26.         }
  27.         catch (Exception e)
  28.         {
  29.             System.out.println("HE MAKES THE CATCH!");
  30.             System.out.println(e.getMessage());
  31.             System.out.println("EXIT CATCH");
  32.         }
  33.     }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement