@Test
    public void application_key_id_isCorrect() {
        //8.2.1
        final String expectedPayload = "56341263964771734fbd76e3b40519d1d94a48".toUpperCase(Locale.US);
        final byte[] appKey = MeshParserUtils.toByteArray("63964771734fbd76e3b40519d1d94a48");
        final int netKeyIndex = 0x123;
        final byte[] networkKeyIndex = {(byte) (netKeyIndex & 0xFF), ((netKeyIndex >> 8) & 0xFF)};

        final int appKeyIndex = 0x456;
        final byte[] applicationKeyIndex = {(byte) (appKeyIndex & 0xFF), ((appKeyIndex >> 8) & 0xFF)};
        final ByteBuffer buffer = ByteBuffer.allocate(19).order(ByteOrder.BIG_ENDIAN);
        buffer.put(applicationKeyIndex[0]);
        buffer.put((byte) (((networkKeyIndex[0] & 0x0F) << 4) | applicationKeyIndex[1]));
        buffer.put((byte) ((((networkKeyIndex[1] & 0x0F) << 4) | ((networkKeyIndex[0] & 0xF0) >> 4))));
        buffer.put(appKey);
        assertEquals(expectedPayload, MeshParserUtils.bytesToHex(buffer.array(), false));
    }
Example local unit test, which will execute on the development machine (host).

@see <a href="http://d.android.com/tools/testing">Testing documentation</a>
mesh/src/test/java/no/nordicsemi/android/mesh/transport/EncryptionTests.java