need some hint
package com.codegym.task.task19.task1914;
/*
Problem solving
*/
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Array;
import java.util.ArrayList;
public class Solution {
public static TestString testString = new TestString();
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
ArrayList<Character> list1 = new ArrayList<>();
PrintStream ps = System.out;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream printStream = new PrintStream(baos);
System.setOut(printStream);
testString.printSomething();
byte[] ch = baos.toByteArray();
for (byte a:
ch) {
if(a>=48 && a<=57){
char x = (char)a;
int num = x - '0';
list.add(num);
}
else if(a==45 || a==42 || a==43){
char x = (char)a;
list1.add(x);
}
}
System.setOut(ps);
if(list1.get(0)=='*'){
int res = list.get(0) * list.get(1);
System.out.println(list.get(0) + " " + list1.get(0) + " " + list.get(1) + " = " + res);
}
if(list1.get(0)=='+'){
int res = list.get(0) + list.get(1);
System.out.println(list.get(0) + " " + list1.get(0) + " " + list.get(1) + " = " + res);
}
if(list1.get(0)=='-'){
int res = list.get(0) - list.get(1);
System.out.println(list.get(0) + " " + list1.get(0) + " " + list.get(1) + " = " + res);
}
}
public static class TestString {
public void printSomething() {
System.out.println("3 - 6 = ");
}
}
}