Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.*;
- public class encryptfiletext
- {
- public static void main (String [] arg) throws IOException{
- Scanner filscan = new Scanner (new File("klasslista.txt"));
- File file = new File("krypteradfil.txt");
- file.createNewFile();
- PrintWriter writer = new PrintWriter("krypteradfil.txt", "UTF-8");
- //writer.write("asdasd");
- //writer.close();
- while(filscan.hasNext())
- {
- String line = filscan.nextLine();
- String krypt_text=encrypt(line);
- System.out.println(krypt_text);
- writer.print(krypt_text);
- writer.close();
- }
- }
- public static String encrypt( String line){
- //Random rng= new Random();
- String krypt_text= "";
- for(int i=0;i<line.length();i++){
- int ascii_ny=(int)line.charAt(i)+1;
- krypt_text=krypt_text+((char)ascii_ny);
- }
- return krypt_text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement