<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.io.*"%>
<html>
<head>
<title>使用RandomAccessFile</title>
</head>
<body>
<center>
<%
    try{
         File f1=new File("c:/tom5.txt");
 int data[]={1,2,3,4,5,6,7,8,9,10};
 RandomAccessFile raf=new RandomAccessFile(f1,"rw");
 for(int i=0;i<data.length;i++)
 {
   raf.writeInt(data[i]);
   }
   /**
        一个int数据占4个字节,从文件的第36个字节读取最后面的一个整数每隔4个字节往前读取一个整数。*/ for(int i=data.length-1;i>=0;i--){
 raf.seek(i*4);
 out.println(raf.readInt());
 }
 raf.close();
 }
 catch(IOException e){
  out.println(e);
  }
  %>
  </center>
  </body>
  </html>"for(int i=data.length-1;i>=0;i--)"为什么不能写成"for(int i=data.length;i>=0;i--)"哪?data.length的值不是10吗,循环的时候不是从尾(10)开始吗,data.length-1就是从9开始循环了,并不包括10呀,。注释部分也不是很理解,希望大家帮我下。