import java.io.BufferedReader; import java.io.InputStreamReader; class HollowBox { public static void main(String[] args) throws java.io.IOException { int h,w; //Buffered readers can improve speed up to 30% as they are less bloated than scanners and don't cause a memory leak when not closed BufferedReader HeightI = new BufferedReader(new InputStreamReader(System.in)); BufferedReader WidthI = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Height"); h = Integer.parseInt(HeightI.readLine()); System.out.println("Width"); w = Integer.parseInt(WidthI.readLine()); //if less than 3, re-enter if(h<3) { System.out.println("Invalid height! Re-enter:"); h = Integer.parseInt(HeightI.readLine()); } if(w<3) { System.out.println("Invalid width! Re-enter:"); w = Integer.parseInt(WidthI.readLine());; } for(int i=0;i