How can I write an integer to a Mifare RFID card using the RFID library?
The dataBlock[] variable is an array of bytes. One byte can represent an integer ranging from -128 to 127, or a positive integer ranging from 0 to 255. If your integer value will always be in one of those ranges, then you can just put your integer in the first element of the array and zero out the remaining.

byte dataBlock[]    = {
    0x01, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00
};


(That saves a value of 1 to the first element, and zeros to the rest. If you want to change the first element:

dataBlock[0] = yourValue;


If your integer is a 2-byte integer, as is typically found in Arduino with type int, you need to split your value into the high byte and low byte:

dataBlock[0] = (byte)(yourValue &amp; 0xFF); // Low byte
dataBlock[1] = (byte)(yourValue &gt;&gt; 8);   // High byte


Then you write the data block as per the example. To get your 2-byte integer value back:

yourValue = ((int)dataBlock[1])&lt;&lt;8 | dataBlock[0];  // Shift high byte, OR with low byte.