xmerge: Use J2SE 5.0 String.{replace|contains}

Replace "String.indexOf(String str)!=-1" with String.contains(String str)
Use J2SE 5.0 String String.replace(CharSequence target, CharSequence replacement).
Format code in needsMask function.

Change-Id: I787a61c4c090f95fb3862390cc1198f7209163a3
Reviewed-on: https://gerrit.libreoffice.org/10659
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>