public class Codes { public static void main(String[] args){ int [] key={5,12,-3,8,-9,4,10}; Integer keyvalue; String encoded=null,decoded=null; String message="dasdasdasdasdasdafdf"; Queue<Integer> encodingQueue=new LinkedList<Integer>(); Queue<Integer> decodingQueue=new LinkedList<Integer>(); for(int i=0;i<key.length;i++){ encodingQueue.add(key[i]); } for(int j=0;j<message.length();j++){ keyvalue=encodingQueue.remove(); encoded+=(char)message.charAt(j)+keyvalue; encodingQueue.add(keyvalue); } System.out.println(encoded);
添加回答
举报
0/150
提交
取消