private static void writeRandomAccessFile(Path path){
        
        SeekableByteChannel sbc=null;
        try {
            sbc = Files.newByteChannel(path, 
                    java.nio.file.StandardOpenOption.CREATE, java.nio.file.StandardOpenOption.WRITE);
            ByteBuffer byteBuffer =ByteBuffer.allocate(92);

            for (int i=0; i<Data.COD.length;i++){
                byteBuffer.clear();
                //COD
                StringBuffer stringBuffer = new StringBuffer(Data.COD[i]);
                stringBuffer.setLength(20); //max 20 caracteres 
                String string = stringBuffer.toString();
                char[] arrayChars = string.toCharArray();
                for (char c : arrayChars){
                    byteBuffer.putChar(c);
                } //40 bytes
                //DESC
                stringBuffer = new StringBuffer(Data.DESC[i]);
                stringBuffer.setLength(20); //max 20 caracteres 
                string = stringBuffer.toString();
                arrayChars = string.toCharArray();
                for (char c : arrayChars){
                    byteBuffer.putChar(c);
                } //40 bytes
                
                byteBuffer.putInt(Data.STOCK[i]); //4 bytes
                byteBuffer.putDouble(Data.PRICE[i]); //8 bytes
                
                byteBuffer.flip(); //The limit is set to the current position and then the position is set to zero
                
                sbc.write(byteBuffer);
            }
            System.out.println("Escritura fichero "+path.getFileName().toString()+ "finalizada");
            readRandomAccessFile(path);
            
        } catch (IOException ex) {
            System.err.println("Error I/O "+ex);
        } finally{
            if (sbc!=null)
                try {
                    sbc.close();
            } catch (IOException ex) {
                System.err.println("Error I/O "+ex);
            }
        }
    }