public static Geocache[] createGeocaches(int a) {
if(a <= 0) return new Geocache[0];
Random rand = new Random();
Geocache[] result = new Geocache[a];
for(int i = 0; i < a; i++) {
//因为题目没有描述,这里假设x, y是随机整数,Geocache有构造函数(int, int)
int x = rand.nextInt();
int y = rand.nextInt();
result[i] = new Geocache(x, y);
}
return result;
}