Question: this is character decoding can you please do this in Java. thank you attached is the question and the program to reference import java.util.Scanner; public

this is character decoding
can you please do this in Java.
thank you
attached is the question and the program to reference  this is character decoding can you please do this in Java.
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; i
a = (int)str.charAt(i);
a = a+4;
if(a>122) {
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
a = (int)str.charAt(i);
str2[i] = "0x"+Integer.toHexString(a);
}
return str2;
}
static String[] evenOdd(String [] str, int length) {
int a =0;
String[] str2 = new String[length];
for(int i=0; i
str2[a] = str[i];
a++;
}
for(int i=1; i
str2[a] = str[i];
a++;
}
return str2;
}
public static void main(String[] args) {
String str;
String str2;
String [] str3;
Scanner sc = new Scanner(System.in);
System.out.print("Input : ");
str = sc.nextLine();
str = removeWhiteSpace(str);
System.out.println("Step 1: After Remove WhiteSpace : "+str);
str = removePunctuation(str);
System.out.println("Step 2: After Remove Punctuation : "+str);
str = lowerCaseConverter(str);
System.out.println("Step 3: Case Folding : "+str);
str = shift4Operation(str);
str2 = upperCaseConverter(str);
System.out.println("Step 4: Shift : "+str+" CaseFolding "+str2);
str3 = hexaConverter(str2);
System.out.print("Step 5: Hex Values are : ");
for (int i = 0; i
System.out.print(str3[i] + " , ");
}
str3 = evenOdd(str3,str3.length);
System.out.println("Listing even position first, then the odd : ");
for (int i = 0; i
System.out.print(str3[i] + " , ");
}
System.out.println();
System.out.print("Step 6: Current ciphertext is : ");
for (int i = 0; i
System.out.print(str3[i] + " , ");
}
System.out.println("Printing in group of 5 : ");
for (int i = 0; i
if(i % 5 == 0 && i!=0) {
System.out.println();
}
System.out.print(str3[i] + " ");
}
}
}
Write a program that decrypts the output created by the program you wrote for assignment 4 by reversing the steps. NOTE: you won't be able to recover whitespace, punctuation symbols or original case this way! Example Given an input @x4 BX50 Ox530x530x50 Bx49 6x500x410x560x48 stop 1. Create a new list of values in the right order 0x4 BX49 X5 X500X530x410x530x560x500x48 step 2. Shift four positions to the left mod 26) x 48 @x45 Bx4c 6x4c 8x4f Ox570x4f ex52x400x44 Step 3. Convert back to characters using UTF-8 encoding HELLO WORLD

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!