Strictly speaking, I think that the C logb function merely returns the exponent bits by ripping them bodily from the argument floating-point number. This is a trivial operation in C, which is allowed to be only semi-portable, and can be done for Java by using a native function, but a true write-once/run-anywhere Java-only solution is more problematic.
It gets even more complicated when you realize that the results of logb (as I understand it) would vary depending on whether the underlying binary floating-point number has been normalized or not. As far as I can recall, Java doesn't have anyway of knowing whether a number has been normalized or not, much less on when and how to coerce it into normalization.
On top of that, the only way you can even begin to consider such a function in Java is courtesy of the standard that Java floating-point numbers in their default form are IEEE-format and thus consistent across computing platforms. The old IBM floating-point exponents were powers of 16, not powers of 2, if I'm not mistaken. And you can tap into them in Java, you just have to indicate their use with the appropriate keyword (which I don't remember offhand, but it may be "native").
Functions like logb are useful in C, where you can directly access the bits of almost anything, for better or for worse. Java, however, operates on a more abstract level and all you can do is fake it and realize that often the results will vary from reality - especially if the system starts normalizing on what you are working with while you are working with it.
As far as faking it, I suppose you could take the decimal logarithm of it, truncate it to an integer which gives the decimal exponent, and make an
ad hoc judgement from there - if the exponent is 1, that's roughly equivalent to 3 as a normalized binary equivalent. An exponent of 2 would be about 8, and so forth with greater "precision" available from examining the range of the original number.
But Java really isn't geared for this kind of thing. Bit primitives aren't a part of the language. The closest thing you'll find is boolean, which is abstractly different, or byte, which is a collection of 8 binary values treated as a
unit. Further, the common C practice of using unions and bitfield definitions is not supported in Java. Java can only operate on physical memory when using native methods.