public static void main(String[] args) {
// TODO Auto-generated method stub
MappedByteBuffer mbb;
FileChannel fc;
int length = 1 << 29; // 512 MB
try {
fc = new RandomAccessFile("/myfile.dat", "rw").getChannel();
mbb = fc.map(FileChannel.MapMode.READ_WRITE, 0, length);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}