1.   StringTokenizer st = new StringTokenizer("this  is  a   test");
     while (st.hasMoreTokens()) {
         System.out.println(st.nextToken());
     }2.String.valueOf( int i )3.Integer.parseInt( String str )

解决方案 »

  1.   

    方法很多阿! FileInputStream, RandomAccessFile........ 很多书都有例子...String a = String.valueOf(int);try
    {
      int b = Integer.parseInt(String);
    }
    catch(Exception ex)
    {
      //catch exception...
    }
      

  2.   

    如果txt就是这样的规律,你可以先一行一行的读取数据,然后用StringTokenizer分割字符串,最后把分割的字符串放到数组里。
    数字转化为字符串:String str=i+"";
    字符串转为数字:Integer.parseInt(str);
      

  3.   

    楼上的,,我也是这么想的,一行一行的读,,,但是怎么写呀,我想用FileInputStream来写,,不过他的方法很少。不知道怎么用呀。
      

  4.   

    in=new   BufferedReader( new  FileReader("e:/jianjian/cgi/1.txt"));
         String s=in.readLine();//读行
      

  5.   

    用RandomAccessFile,速度虽然慢了点。
    但是非常方便!!!
      

  6.   

    我只写了这么多就出现了乱码,请问怎么解决呀?
       while(MMenuFile.getFilePointer()<MMenuFile.length()){
      
              String Items=MMenuFile.readLine();
              System.out.println(Items);
          }怎么解决乱码呀