Bug 1000839: Fixes and unit tests for NfcUtils.encodeNDEF()

I prefer to use `ndefMessages.forEach` rather to plain loop. And, please avoid i,j,k variables.