Test while you code
public static void main (String[] args){
byte p1[] = new byte[100] ;
int a = System.in.read(p1); // returns the number of bytes
String p2 = new String(p1,0,a); //build string from array
System.out.println(p2); // check to see if all goes well