public static void main(String[] args) throws Exception {
        //final PlcConnection connection = new DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=BIG_ENDIAN");
        final PlcConnection connection = new DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=LITTLE_ENDIAN");
        //final PlcConnection connection = new DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=BIG_ENDIAN_BYTE_SWAP");
        //final PlcConnection connection = new DefaultPlcDriverManager().getConnection("modbus-tcp://10.211.55.3?default-payload-byte-order=LITTLE_ENDIAN_BYTE_SWAP");
        final PlcReadRequest readRequest = connection.readRequestBuilder()
            .addTagAddress("16 bit BigEndian", "holding-register:1:WORD{byte-order:'BIG_ENDIAN'}")
            .addTagAddress("16 bit LittleEndian", "holding-register:2:WORD{byte-order:'LITTLE_ENDIAN'}")
            .addTagAddress("32 bit BigEndian", "holding-register:3:DWORD{byte-order:'BIG_ENDIAN'}")
            .addTagAddress("32 bit LittleEndian", "holding-register:5:DWORD{byte-order:'LITTLE_ENDIAN'}")
            .addTagAddress("32 bit BigEndianByteSwap", "holding-register:7:DWORD{byte-order:'BIG_ENDIAN_BYTE_SWAP'}")
            .addTagAddress("32 bit LittleEndianByteSwap", "holding-register:9:DWORD{byte-order:'LITTLE_ENDIAN_BYTE_SWAP'}")
            .addTagAddress("64 bit BigEndian", "holding-register:11:LWORD{byte-order:'BIG_ENDIAN'}")
            .addTagAddress("64 bit LittleEndian", "holding-register:15:LWORD{byte-order:'LITTLE_ENDIAN'}")
            .addTagAddress("64 bit BigEndianByteSwap", "holding-register:19:LWORD{byte-order:'BIG_ENDIAN_BYTE_SWAP'}")
            .addTagAddress("64 bit LittleEndianByteSwap", "holding-register:23:LWORD{byte-order:'LITTLE_ENDIAN_BYTE_SWAP'}")
            .build();
        final PlcReadResponse plcReadResponse = readRequest.execute().get();
        connection.close();
        System.out.println("16 bit BigEndian:            " + String.format("0x%04X", plcReadResponse.getInteger("16 bit BigEndian")));
        System.out.println("16 bit LittleEndian:         " + String.format("0x%04X", plcReadResponse.getInteger("16 bit LittleEndian")));
        System.out.println("32 bit BigEndian:            " + String.format("0x%08X", plcReadResponse.getInteger("32 bit BigEndian")));
        System.out.println("32 bit LittleEndian:         " + String.format("0x%08X", plcReadResponse.getInteger("32 bit LittleEndian")));
        System.out.println("32 bit BigEndianByteSwap:    " + String.format("0x%08X", plcReadResponse.getInteger("32 bit BigEndianByteSwap")));
        System.out.println("32 bit LittleEndianByteSwap: " + String.format("0x%08X", plcReadResponse.getInteger("32 bit LittleEndianByteSwap")));
        System.out.println("64 bit BigEndian:            " + String.format("0x%016X", plcReadResponse.getLong("64 bit BigEndian")));
        System.out.println("64 bit LittleEndian:         " + String.format("0x%016X", plcReadResponse.getLong("64 bit LittleEndian")));
        System.out.println("64 bit BigEndianByteSwap:    " + String.format("0x%016X", plcReadResponse.getLong("64 bit BigEndianByteSwap")));
        System.out.println("64 bit LittleEndianByteSwap: " + String.format("0x%016X", plcReadResponse.getLong("64 bit LittleEndianByteSwap")));
    }
Test programm made to work with the Modbus Simulator from https://www.modbustools.com/modbus_slave.html
In contrast to others, this allows simulating the various types of modbus byte orders.

@param args
@throws Exception
plc4j/drivers/modbus/src/test/java/org/apache/plc4x/java/modbus/ManualDriverTest.java