// Float.floatToIntBits( float ) = Returns a representation of the specified // floating-point value according to the IEEE 754 format public class func_call_conv1 { 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 float f( float x) { System.out.print(" Inp param x = " + x + ", repr in bits: "); printBitFloat(x); System.out.println(); float r; r = x*x; System.out.print(" Return value = " + r + ", repr in bits: "); printBitFloat(r); System.out.println("\n"); return(r); } public static void main(String[] args) { int a, b; a = 2; System.out.print("a = " + a + ", repr in bits: "); printBitInt(a); System.out.println("\n"); b = (int) f(a); System.out.print("b = " + b + ", repr in bits: "); printBitInt(b); System.out.println("\n"); } }