Example usage for java.lang Float MIN_NORMAL

List of usage examples for java.lang Float MIN_NORMAL

Introduction

In this page you can find the example usage for java.lang Float MIN_NORMAL.

Prototype

float MIN_NORMAL

To view the source code for java.lang Float MIN_NORMAL.

Click Source Link

Document

A constant holding the smallest positive normal value of type float , 2-126.

Usage

From source file:com.magnet.android.mms.controller.RequestPrimitiveTest.java

@SmallTest
public void testSingleListFloatPostParam() throws JSONException {
    ControllerHandler handler = new ControllerHandler();
    String methodName = "postFloats";
    JMethod method = new JMethod();
    JMeta metaInfo = new JMeta(methodName, API_METHOD_POST + methodName, POST);
    method.setMetaInfo(metaInfo);/*ww  w .j  a  v  a2  s  . com*/

    // int
    method.addParam("param0", PLAIN, List.class, Float.class, "", false);

    List<Float> values = new ArrayList<Float>();
    values.add(Float.MAX_VALUE);
    values.add(Float.MIN_NORMAL);

    String uriString = handler.buildUri(method, new Object[] { values });
    String bodyString = handler.buildRequestBodyString(method, new Object[] { values });

    String expected = API_METHOD_POST + methodName;
    logger.log(Level.INFO, "uriString=" + uriString);
    logger.log(Level.INFO, "bodyString=" + bodyString);
    assertEquals(expected, uriString);

    JSONArray jarray = new JSONArray(bodyString);
    int idx = 0;
    for (Float value : values) {
        String sf = jarray.getString(idx);
        float f = Float.parseFloat(sf);
        assertEquals(value, f);
        idx++;
    }
}