DeviceManager dm;
try {
dm = InitialNaming.lookup(DeviceManager.NAME);
IDEDevice current = (IDEDevice) dm.getDevice(args[0]);
BlockDeviceAPI api = current.getAPI(BlockDeviceAPI.class);
int size = (int) (Math.random() * 5 /*256*/) * 512;
int offset = (int) (Math.random() * 10000) * 512;
System.out.println("Create Random Buffer");
System.out.println("Size = " + size);
byte[] src = new byte[size];
for (int i = 0; i < size; i++) {
src[i] = (byte) (Math.random() * 255);
}
System.out.println("Put it at " + offset);
api.write(offset, ByteBuffer.wrap(src));
System.out.println("Retreive it back ...");
byte[] dest = new byte[size];
api.read(offset, ByteBuffer.wrap(dest));
System.out.println("Check consistency ...");
for (int i = 0; i < size; i++) {
System.out.print(src[i] + "|" + dest[i] + ",");
if (src[i] != dest[i])