Java Asterisk Rectangle
Logically, there should be an asterisk (*) every time i == j and i+j==w-1(for diagonals), i == 0 and j == 0 (for top line and left side) and j == w-1 and i==h-1  (for right side and bottom line).
class d {
    public static void main(String[] a) {
        for(int i=0,w=new Byte(a[0]),h=new Byte(a[1]);i&lt;h;i++) {
            for(int j=0;j&lt;w;j++) {
                System.out.print(i==0 || j==0 || i==h-1 || i+j==w-1 || j==w-1 || i==j ? &quot;*&quot;:&quot; &quot;);
            }
            System.out.println();
        }
    }
}