Here you can find the source of chooseAppropriateTileSize(BufferedImage image)
public static int chooseAppropriateTileSize(BufferedImage image)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.awt.Component; import java.awt.image.BufferedImage; public class Main { public static int chooseAppropriateTileSize(BufferedImage image) { int width = image.getWidth(); int height = image.getHeight(); int tileSize = (int) (Math.sqrt(Math.sqrt(width * height)) * 1.5); return tileSize; }/*from w w w . jav a 2s . c om*/ public static int chooseAppropriateTileSize(Component component) { int width = component.getWidth(); int height = component.getHeight(); if (width == 0) throw new IllegalStateException("Component width is 0"); if (height == 0) throw new IllegalStateException("Component height is 0"); int tileSize = (int) (Math.sqrt(Math.sqrt(width * height)) * 1.5); return tileSize; } }