This worked for me
Hope this helps =)
P.S. Don't know why the length keeps returning 2 plus the length of the array.
code:<HR>Code:import java.io.*;<P>public class test { public static void main(String args[]) { try { byte[] b = new byte[100]; System.out.print("Enter Integer: "); int len = System.in.read(b); String str = new String(b, 0, (len - 2)); int output = new Integer(str).intValue(); System.out.println(output); } catch (IOException e ) { System.exit(-1); } }<P>}
Hope this helps =)
P.S. Don't know why the length keeps returning 2 plus the length of the array.