Here you can find the source of drawSquare(BufferedImage image, int x, int y, int size, int pixel)
private static void drawSquare(BufferedImage image, int x, int y, int size, int pixel)
//package com.java2s; //License from project: Open Source License import java.awt.image.BufferedImage; public class Main { private static void drawSquare(BufferedImage image, int x, int y, int size, int pixel) { for (int px = 0; px < size; ++px) { for (int py = 0; py < size; ++py) { image.setRGB(x + px, y + py, pixel); }/* w w w . j a v a 2 s. com*/ } } }