import java.util.Random; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Graphics; public class canv extends Canvas { public int w, h, v = 0, n = 5; public Random rnd; public int[] mass = new int[n]; public canv() { w = getWidth();//ширина h = getHeight();//высота setFullScreenMode(true); } public void paint(Graphics g) { g.setColor(70, 70, 70); g.fillRect(0, 0, w, h); g.setColor(0, 255, 0); for (int i = 0; i < n; i++) { mass[i] = Math.abs(rnd.nextInt()) % 30; v += 15; g.drawString("mass" + i + "=" + mass[i], 0, v, 20); if ((mass[i] % 2) == 0) { g.drawString("mass2" + i + "=" + mass[i], 80, v, 20); } } } protected void keyPressed(int k) { int key = k; if (key == KEY_NUM2) { repaint(); } if (key == KEY_NUM8) { repaint(); } } }