Java tutorial
//package com.java2s; public class Main { public static int[] getLine(int height, int width) { int[] tempCheckNum = { 0, 0, 0, 0, 0 }; for (int i = 0; i < 4; i += 2) { tempCheckNum[i] = (int) (Math.random() * width); tempCheckNum[i + 1] = (int) (Math.random() * height); } return tempCheckNum; } }