Java tutorial
//package com.java2s; public class Main { public static float HexString2Float(String string) { byte[] bytes = HexString2Bytes(string); return getFloat(bytes); } public static byte[] HexString2Bytes(String src) { byte[] ret = new byte[src.length() / 2]; byte[] tmp = src.getBytes(); for (int i = 0; i < ret.length; ++i) { ret[i] = uniteBytes(tmp[i * 2], tmp[i * 2 + 1]); } return ret; } public static float getFloat(byte[] b) { int accum = 0; accum = accum | (b[3] & 0xff) << 0; accum = accum | (b[2] & 0xff) << 8; accum = accum | (b[1] & 0xff) << 16; accum = accum | (b[0] & 0xff) << 24; return Float.intBitsToFloat(accum); } public static byte uniteBytes(byte src0, byte src1) { byte _b0 = Byte.decode("0x" + new String(new byte[] { src0 })).byteValue(); _b0 = (byte) (_b0 << 4); byte _b1 = Byte.decode("0x" + new String(new byte[] { src1 })).byteValue(); byte ret = (byte) (_b0 | _b1); return ret; } }