A code that is completed in J2SE, I spent an afternoon in J2ME. What kind of code? [Requirements] Hints [Analysis] J2ME for reading in the game in the game is not bufferreader, use inputstreamReader Since there is no BufferReader, don't expect to have readline (), you will slowly loop [Source code] / * read hint ------------------------------------------------------------------------------------------ ------------------ * / / ** * this is the hints * * / string [] [] hintstr;
/ ** * this specified the hint's show width * / final int hint_width = 8; int hint_num
Public Boolean Readhint (int Stage) {
IF (Stage> 0 && Stage <4) {if (stage == 2) {hint_num = 4;} else {hint_num = 3;}} else {system.out.println ("no this stage"; return false; }
try {String filename = "hint" Integer.toString (stage); InputStreamReader in = new InputStreamReader (getClass () .getResourceAsStream (filename)); int num = -1; do { num;} while (in.read ()! = -1); In.Rset (); char [] hintsdat = new char [num]; system.out.println (num); in.read (hint (hintsdat); in. Close ();
String Hint_Temp = New String (Hintsdat);
INT j = 0; int i = 0; string hint_num_temp [] = new string [hint_num]; for (int x = 0; x IF (i Break; // system.out.println ("CREATI ...."); J = 0; for (i = 0; i