Also available as SysIn.java

/**
 * Title: SysIn
 * Description: System.in as an InputStream
 *   echo up to the first 10 chars read
 * @author hollingd@cs.rpi.edu
 */
import java.io.*;

public class SysIn{

    public static void main(String[] args){
        byte []b = new byte[10];
        InputStream stdin = System.in;
        try {
            int len = stdin.read(b);        
            for (int i=0;i<len;i++) 
                System.out.write(b[i]);
            System.out.flush();
        } catch ( IOException e) {
            e.printStackTrace();
        }
    }
}