BUG-1346: fix wrong prefix generation

Java promotion rules are slightly different than C, so the expression
got promoted to int, which obviously did the wrong thing. Add an
explicit cast to prevent it.

+test

Change-Id: Id9e708ca86b7267b84b2a3db5ad52aeef651763d
Signed-off-by: Robert Varga <rovarga@cisco.com>
Signed-off-by: Timotej Kubas <tkubas@cisco.com>