Convert to bytes

Report a typo

Read an input text from the console and print it as a sequence of bytes.

Use System.in as input stream directly. Avoid using Scanner.

Sample Input 1:

abc

Sample Output 1:

979899

Sample Input 2:

another text

Sample Output 2:

9711011111610410111432116101120116
Write a program in Java 17
import java.io.InputStream;

class Main {
public static void main(String[] args) throws Exception {
InputStream inputStream = System.in;
}
}
___

Create a free account to access the full topic