/*
* Tools.java
* Download by http://www.codefans.net
* Created on 2005年12月13日, 下午2:05
*
* To change this template, choose Tools | Options and locate the template under
* the Source Creation and Management node. Right-click the template and choose
* Open. You can then make changes to the template in the Source Editor.
*/
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.Graphics;
import java.util.*;
/**
*
* @author YBGame_xu
*/
public final class Tools {
public static final int GRAPHCS_TOP_LEFT=Graphics.TOP | Graphics.LEFT;
private static final Random randomizer=new Random();
public static int[] Numerics=new int[10];
//将数组的长度增加
/*
public final static int[] expandArray(int[] oldArray, int expandBy){
int[] newArray=new int[oldArray.length+expandBy];
System.arraycopy(oldArray, 0,newArray, 0, oldArray.length);
return newArray;
}
public final static Image[][]expandArray(Image[][] oldArray,int expandBy){
Image[][] newArray=new Image[oldArray.length+expandBy][];
System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);
return newArray;
}
**/
public final static int getRand(int min,int max){
int r=Math.abs(randomizer.nextInt());
return (r% ((max-min + 1))) + min;
}
public final static int setNumerics(int s){
if (s==0){
Numerics[0]=0;
return 0;
}
int t;
int j=-1;
while(s>0){
t=s%10;
Numerics[++j]=t;
s=s/10;
}
return j;
}
}