// Float.floatToIntBits( float ) = Returns a representation of the specified // floating-point value according to the IEEE 754 format public class func_call_conv2 { static void printBitFloat( float x ) { int i; for ( i = 31; i >= 0; i-- ) { if ( (Float.floatToIntBits(x) & (1 << i)) != 0 ) System.out.print("1"); else System.out.print("0"); } } static void printBitInt( int x ) { int i; for ( i = 31; i >= 0; i-- ) { if ( (x & (1 << i)) != 0 ) System.out.print("1"); else System.out.print("0"); } } static int f( float x) { System.out.print(" Inp param x = " + x + ", repr in bits: "); printBitFloat(x); System.out.println(); int r; r = (int) (x*x); System.out.print(" Return value = " + r + ", repr in bits: "); printBitInt(r); System.out.println("\n"); return(r); } public static void main(String[] args) { int a; float b; a = 2; System.out.print("a = " + a + ", repr in bits: "); printBitInt(a); System.out.println("\n"); b = f(a); System.out.print("b = " + b + ", repr in bits: "); printBitFloat(b); System.out.println("\n"); } }