Java examples for java.lang:Math Number
Returns the number of vertical subdivisions the argument image needs to be divided into to respect argument size
import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; public class Main{ /**/* w w w . j a v a 2s .co m*/ * Returns the number of vertical subdivisions the argument image needs to * be divided into to respect argument maxTexDim size * * @param sourceImg * @param maxTexDim * @return the number of texture matrices */ public static int getNumTextureMatrixPerColumn(Image sourceImg, int maxTexDim) { if (null != sourceImg) { //define number of needed subdivisions int numSubTexPerColumn = 0, imgH = sourceImg.getHeight(); while (maxTexDim * numSubTexPerColumn < imgH) ++numSubTexPerColumn; return numSubTexPerColumn; } return -1; } }