byte[] addr = new byte[2]; // addr[0] = 0x00; // addr[1] = 0x00; // addr[2] = 'F'; addr[0] = 'X'; addr[1] = '\n'; s_logger.info("arr0 : " + (char) addr[0]); ByteBuffer buf = ByteBuffer.wrap(addr); try { // slave.begin(); // Begins communication s_logger.info("communication begin"); int count = slave.write(0x00, 2, buf); s_logger.info("count : " + count); s_logger.info("data writen"); ByteBuffer WriteBuffer; WriteBuffer = ByteBuffer.allocateDirect(1); // byte bb = WriteBuffer.get(0); // byte bb1 = WriteBuffer.get(1); int c = slave.read(0x00, 1, WriteBuffer); s_logger.info("Read C : " + c); // byte bb = WriteBuffer.get(1); byte bb = WriteBuffer.get(0); s_logger.info("data : " + (char) bb); // s_logger.info("data1 : " + (char) bb1); // slave.end(); s_logger.info("comm end"); slave.close(); s_logger.info("close slave"); } catch ( UnavailableDeviceException e) { s_logger.info("" + e); } catch (ClosedDeviceException e) { s_logger.info("" + e); } catch (IOException e) { s_logger.info("" + e); }