Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE DO THIS IN JAVA. THIS IS CHARACTER DECODING. Write a program that decrypts the output created by the program given by reversing the steps.
PLEASE DO THIS IN JAVA. THIS IS CHARACTER DECODING.
Write a program that decrypts the output created by the program given by reversing the steps. NOTE: you won't be able to recover whitespace, punctuation symbols or original case this way!
Example:
Given an input:
0x4C 0x50 0x53 0x53 0x50 0x49 0x50 0x41 0x56 0x48
step 1. Create a new list of values in the right order
0x4c 0x49 0x50 0x50 0x53 0x41 0x53 0x56 0x50 0x48
step 2. Shift four positions to the left (mod 26)
0x48 0x45 0x4c 0x4c 0x4f 0x57 0x4f 0x52 0x4c 0x44
Step 3. Convert back to characters using UTF-8 encoding
H E L L O W O R L D
PROGRAM-
import java.util.Scanner; public class Ass11 { static String removePunctuation(String str) { return str.replaceAll("\\W", ""); } static String removeWhiteSpace(String str) { return str.replaceAll("\\s", ""); } static String lowerCaseConverter(String str) { return str.toLowerCase(); } static String shift4Operation(String str) { String str2=""; int a; for(int i=0; i122) { int s = a - 123; a = 97 + s; } str2 = str2 + (char)a; } return str2; } static String upperCaseConverter(String str) { return str.toUpperCase(); } static String[] hexaConverter(String str) { int a; String[] str2 = new String[str.length()]; for(int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started