import java.io.*; import java.util.*; import javax.microedition.rms.*; class Korvisisu{ RecordStore rsm; RecordStore rsv; void paneKorvi(int seeneke) { try { rsm=RecordStore.openRecordStore("shoidlam", true); rsv=RecordStore.openRecordStore("shoidlav", true); byte ms=0; byte vs=0; if(seeneke==0) { if(rsv.getNumRecords()==0) { rsv.addRecord(new byte[]{(byte)(vs+1)}, 0, 1); } else { vs=rsv.getRecord(1)[0]; rsv.setRecord(1, new byte[]{(byte)(vs+1)}, 0, 1); } System.out.println("Vseeni: "+vs); } else { if(rsm.getNumRecords()==0) { rsm.addRecord(new byte[]{(byte)(ms+1)}, 0, 1); } else { ms=rsm.getRecord(1)[0]; rsm.setRecord(1, new byte[]{(byte)(ms+1)}, 0, 1); } System.out.println("Mseeni: "+ms); } } catch(Exception e){} } int kysi(int mida) throws Exception { if(mida==0) { ByteArrayInputStream bis=new ByteArrayInputStream(rsv.getRecord(1)); DataInputStream dis=new DataInputStream(bis); int vseen=dis.readInt(); return vseen; } else { ByteArrayInputStream bis=new ByteArrayInputStream(rsm.getRecord(1)); DataInputStream dis=new DataInputStream(bis); int mseen=dis.readInt(); return mseen; } } }