Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. public class Uebung5_5 {
  2.  
  3. public static void main(String[] args) {
  4. char decode;
  5. char input = args[0].charAt(0);
  6. int position = Integer.parseInt(args[1]);
  7.  
  8. if (position >26) {
  9. System.out.println("please enter a value between 0-26");
  10. System.exit(1);
  11. }
  12.  
  13. if (input+position > 'Z') {
  14. decode = (char)(('A' + ( position - ('Z' - input )))-1);
  15. } else {
  16. decode = (char)(input+position);
  17. }
  18. System.out.println(input+" => "+decode);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement