Converting Fixnum to primitive int

Hi, I’m trying to figure out a way to convert a Fixnum value into a java
primitive int. I look for 1.to_java(:int) but it returns the same. How
can I do that?
My method is raising because it’s expecting a int and it’s receiving a
java.lang.Long.

It must be something with your specific code. Generally the conversion
happens automatically and correctly. For example, this code correctly
prints 1 to the console with jruby 1.6.1:

require ‘java’
import ‘java.lang.Integer’
puts Integer.toString(1)