Question is at bottom of code
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Scanner;
public class Encoder {
public static void main(String[] args){
try {
//input scanner created
Scanner sc = new Scanner(System.in);
System.out.print("Enter the message you want to encode and hit enter: ");
String text = sc.nextLine();
// Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.
byte[] bytes = text.getBytes("US-ASCII");
System.out.println("Your encoded message is: " + " " + Arrays.toString(bytes));
}
catch (UnsupportedEncodingException e) {
// catch block
System.out.println("Wrong" + e);
}
}
}
My output: Enter the message you want to encode and hit enter: Hello World! Your encoded message is: [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]
The Question: With the code that I have, is it possible to A) offset the values in the array (ex. offset[72] to [84]), and B) how would I do it.