Fix incorrect network prefix in Java Meterpreter

Apparently, getNetworkPrefixLength can return -1, which confuses the Ruby
side. Therefore fall back to guessing the prefix in this case, as we do it
for Java <= 1.6.

This may cause spurious errors like `warning: in a**b, b may be too big`, and ifconfig command may stop with an error that ~ cannot be applied to -1.