Update device size derivation to work in jruby