Java Asterisk Rectangle For my CS class, my instructor has given us the assignment of creating a rectangle made of asterisks with diagonal lines drawn through it in Java.
He also told us to write it in as few bytes as possible. I've gotten it down to 190 bytes, but I need to find a few to simplify this code even more to decrease bytes. Can anyone help me with this?
This code is functional:
interface d{static void main(String[]a){for(int z=0,w=new Byte(a[0]),h=new Byte(a[1]);z&lt;h*w;){int y=z/w,x=z++%w;System.out.print((x&gt;w-2)?&quot;*\n&quot;:(y%(h-1)*x*((y-x)%3)==0)?&quot;*&quot;:&quot; &quot;);}}}

Input is 10 10.
Output:
**********
**  *  * *
* *  *  **
*  *  *  *
**  *  * *
* *  *  **
*  *  *  *
**  *  * *
* *  *  **
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();
        }
    }
}