This tip shows you how to create the RED color using the “<<" and "|" operators. After that, the color is used to fill a rectangle:
import java.awt.*;class draw_red_rect extends Frame{Color col=null;public draw_red_rect() { super(); }public void init() { setLayout(null); setSize(100,100); int A=255<<24; int R=255<<16; int G=0<<8; int B=0<<0; //int B=0; System.out.println("A="+A+",R="+R+",G="+G+",B="+B); int RED=A | R | G | B; col=new Color(RED); System.out.println("RED="+RED+" // getRGB="+col.getRGB()); System.out.println("RED_BINAR= "+Integer.toBinaryString(col.getRGB())); setVisible(true); //show(); }public void paint(Graphics g) { g.setColor(col); g.fillRect(30,30,50,50); }}public class red{ public static void main(String[] args){ draw_red_rect t=new draw_red_rect(); t.init(); }}