Before that sorry for my bad english because it's not my first language. Excuse me, i'm trying to convert array byte to string in error handling try catch java. And if user input integers, the result will be +2. I've tried but always error, i hope someone can help me.
Here's my code:
package exception;
public class TugasTiga {
public static void main (String [] args) {
byte[] b = new byte[5];
System.out.println("Input bilangan bulat: ");
try { System.in.read(b);
} catch (java.io.IOException e);
int N = Integer.valueOf(b).intValue();
System.out.println("Hasil: " + (N+2));
}
}