FloatBuffer.compareTo(FloatBuffer that) has the following syntax.
public int compareTo(FloatBuffer that)
In the following code shows how to use FloatBuffer.compareTo(FloatBuffer that) method.
import java.nio.FloatBuffer; //ww w. j a va 2 s . c om public class Main { public static void main(String[] args) { FloatBuffer floatBuffer = FloatBuffer.allocate(10); floatBuffer.put(0,1.23F); floatBuffer.rewind(); FloatBuffer floatBuffer1 = floatBuffer.compact(); System.out.println(floatBuffer.compareTo(floatBuffer1)); } }
The code above generates the following result.