Example usage for java.lang Short toString

List of usage examples for java.lang Short toString

Introduction

In this page you can find the example usage for java.lang Short toString.

Prototype

public static String toString(short s) 

Source Link

Document

Returns a new String object representing the specified short .

Usage

From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.CFAccURLProtocolPKey.java

public String toString() {
    String ret = "<CFAccURLProtocolPKey" + " RequiredURLProtocolId=" + "\""
            + Short.toString(getRequiredURLProtocolId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKb.CFGenKbAuditActionPKey.java

public String toString() {
    String ret = "<CFGenKbAuditActionPKey" + " RequiredAuditActionId=" + "\""
            + Short.toString(getRequiredAuditActionId()) + "\"" + "/>";
    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcore.v2_0.CFGenKb.CFGenKbISOTimezonePKey.java

public String toString() {
    String ret = "<CFGenKbISOTimezonePKey" + " RequiredISOTimezoneId=" + "\""
            + Short.toString(getRequiredISOTimezoneId()) + "\"" + "/>";
    return (ret);
}

From source file:SignificantFigures.java

/**
 * Create a SignificantFigures object from a short.
 *
 * @param number a 16 bit integer./* www . j  a  va2  s . c om*/
 *
 * @since ostermillerutils 1.00.00
 */
public SignificantFigures(short number) {
    original = Short.toString(number);
    try {
        parse(original);
    } catch (NumberFormatException nfe) {
        digits = null;
    }
}

From source file:net.sourceforge.msscodefactory.cfgcash.v2_0.CFGCash.CFGCashAuditActionPKey.java

public String toString() {
    String ret = "<CFGCashAuditActionPKey" + " RequiredAuditActionId=" + "\""
            + Short.toString(getRequiredAuditActionId()) + "\"" + "/>";
    return (ret);
}

From source file:io.coala.config.AbstractPropertyGetter.java

/**
 * @param defaultValue/*from  ww w  .  j  av  a2s.c  o m*/
 * @return
 */
public Short getShort(final Short defaultValue) {
    final String value = get(defaultValue == null ? null : Short.toString(defaultValue));
    return value == null ? null : Short.valueOf(value);
}

From source file:com.navercorp.pinpoint.plugin.httpclient4.interceptor.HttpRequestExecutorExecuteMethodInterceptor.java

@Override
public void before(Object target, Object[] args) {
    if (isDebug) {
        logger.beforeInterceptor(target, args);
    }/*from   w w  w.  j  a v a  2s . c o  m*/
    final Trace trace = traceContext.currentRawTraceObject();
    if (trace == null) {
        return;
    }

    final HttpRequest httpRequest = getHttpRequest(args);

    final boolean sampling = trace.canSampled();
    if (!sampling) {
        if (isDebug) {
            logger.debug("set Sampling flag=false");
        }
        if (httpRequest != null) {
            httpRequest.setHeader(Header.HTTP_SAMPLED.toString(), SamplingFlagUtils.SAMPLING_RATE_FALSE);
        }
        return;
    }

    final SpanEventRecorder recorder = trace.traceBlockBegin();
    TraceId nextId = trace.getTraceId().getNextTraceId();
    recorder.recordNextSpanId(nextId.getSpanId());
    recorder.recordServiceType(HttpClient4Constants.HTTP_CLIENT_4);

    if (httpRequest != null) {
        httpRequest.setHeader(Header.HTTP_TRACE_ID.toString(), nextId.getTransactionId());
        httpRequest.setHeader(Header.HTTP_SPAN_ID.toString(), String.valueOf(nextId.getSpanId()));

        httpRequest.setHeader(Header.HTTP_PARENT_SPAN_ID.toString(), String.valueOf(nextId.getParentSpanId()));

        httpRequest.setHeader(Header.HTTP_FLAGS.toString(), String.valueOf(nextId.getFlags()));
        httpRequest.setHeader(Header.HTTP_PARENT_APPLICATION_NAME.toString(),
                traceContext.getApplicationName());
        httpRequest.setHeader(Header.HTTP_PARENT_APPLICATION_TYPE.toString(),
                Short.toString(traceContext.getServerTypeCode()));
        final NameIntValuePair<String> host = getHost();
        if (host != null) {
            final String endpoint = getEndpoint(host.getName(), host.getValue());
            logger.debug("Get host {}", endpoint);
            httpRequest.setHeader(Header.HTTP_HOST.toString(), endpoint);
        }
    }

    InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
    if (invocation != null) {
        invocation.getOrCreateAttachment(HttpCallContextFactory.HTTPCALL_CONTEXT_FACTORY);
    }
}

From source file:de.unistuttgart.ipvs.pmp.infoapp.webservice.properties.DeviceProperties.java

@Override
public void commit() throws InternalDatabaseException, InvalidParameterException, IOException {
    try {/*w ww .  j  a  va  2 s .  c  o m*/
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair("manufacturer", this.deviceOem.manufacturer));
        params.add(new BasicNameValuePair("apiLevel", Byte.toString(this.api)));
        params.add(new BasicNameValuePair("kernel", this.kernel));
        params.add(new BasicNameValuePair("model", this.deviceOem.model));
        params.add(new BasicNameValuePair("ui", this.deviceOem.ui));
        params.add(new BasicNameValuePair("displayResX", Short.toString(this.display.x)));
        params.add(new BasicNameValuePair("displayResY", Short.toString(this.display.y)));
        params.add(new BasicNameValuePair("cpuFrequency", Short.toString(this.cpu)));
        params.add(new BasicNameValuePair("memoryInternal", Short.toString(this.memoryInternal.total)));
        params.add(new BasicNameValuePair("memoryInternalFree", Short.toString(this.memoryInternal.free)));
        params.add(new BasicNameValuePair("memoryExternal", Short.toString(this.memoryExternal.total)));
        params.add(new BasicNameValuePair("memoryExternalFree", Short.toString(this.memoryExternal.free)));
        params.add(new BasicNameValuePair("cameraResolution", Float.toString(this.cameraRes)));

        StringBuilder sensorsSb = new StringBuilder();
        boolean first = true;
        for (String sensor : this.sensors) {
            if (first) {
                first = false;
            } else {
                sensorsSb.append(",");
            }
            sensorsSb.append(sensor);
        }
        params.add(new BasicNameValuePair("sensors", sensorsSb.toString()));

        params.add(new BasicNameValuePair("runtime", Float.toString(this.runtime)));

        super.service.requestPostService("update_device.php", params);
    } catch (JSONException e) {
        throw new IOException("Server returned no valid JSON object: " + e);
    }
}

From source file:ecg.ecgshow.ECGShowUI.java

private void createHeartRateData(long timeZone) {
    HeartRatedatas = new short[2];
    HeartRateData = new JPanel();
    //HeartRateData.setLayout(new BorderLayout());
    HeartRateData.setLayout(new FlowLayout());
    HeartRateData.setBounds(0, 0, (int) (WIDTH * 0.14), (int) (HEIGHT * 0.15));
    HeartRateData.setBackground(Color.BLACK);

    JLabel jLabel1 = new JLabel("---");
    if (HeartRatedatas[0] == 0x00 || HeartRatedatas == null) {
        jLabel1.setText("---");
    } else {// w w  w.j a va  2 s  .c  om
        jLabel1.setText(Short.toString((short) HeartRatedatas[0]));
    }

    jLabel1.setFont(loadFont("LED.tff", (float) (HEIGHT * 0.070)));
    jLabel1.setBackground(Color.BLACK);
    jLabel1.setForeground(Color.GREEN);
    jLabel1.setBounds(0, 0, 100, 100);
    jLabel1.setOpaque(true); //??

    JLabel jLabelName = new JLabel(" ");
    jLabelName.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    jLabelName.setBackground(Color.BLACK);
    jLabelName.setForeground(new Color(237, 65, 43));
    jLabelName.setBounds(0, 0, 100, 100);
    jLabelName.setOpaque(true); //??

    JLabel jLabelUnit = new JLabel(" bpm");
    jLabelUnit.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    jLabelUnit.setBackground(Color.BLACK);
    jLabelUnit.setForeground(Color.GREEN);
    jLabelUnit.setBounds(0, 0, 100, 100);
    jLabelUnit.setOpaque(true); //??

    HeartRateData.add(jLabelName);
    HeartRateData.add(jLabel1);
    HeartRateData.add(jLabelUnit);
    System.out.println("HeartRatedatas" + Short.toString(HeartRatedatas[0]));
    ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
    scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
        @Override
        public void run() {
            if (HeartRatedatas[0] == -100 || HeartRatedatas[0] == 156 || HeartRatedatas[0] == 0) {
                jLabel1.setText("--");
            } else {
                jLabel1.setText(String.valueOf(HeartRatedatas[0]));
            }
            HeartRateData.repaint();
        }
    }, 0, 3, TimeUnit.SECONDS);
}

From source file:com.magnet.android.mms.request.GenericResponseParserPrimitiveTest.java

@SmallTest
public void testNumberResponse() throws MobileException, JSONException {
    GenericResponseParser<Integer> parser = new GenericResponseParser<Integer>(Integer.class);
    String response = Integer.toString(Integer.MIN_VALUE);

    Integer result = (Integer) parser.parseResponse(response.toString().getBytes());
    assertEquals(Integer.MIN_VALUE, result.intValue());

    Object nullresult = parser.parseResponse((byte[]) null);
    assertEquals(null, nullresult);/*from   w  ww.  j  a  va  2 s .  c o m*/

    long longvalue = new Random().nextLong();
    GenericResponseParser<Long> lparser = new GenericResponseParser<Long>(Long.class);
    long longresult = (Long) lparser.parseResponse(Long.toString(longvalue).getBytes());
    assertEquals(longvalue, longresult);

    short shortvalue = Short.MAX_VALUE;
    GenericResponseParser<Short> sparser = new GenericResponseParser<Short>(short.class);
    short shortresult = (Short) sparser.parseResponse(Short.toString(shortvalue).getBytes());
    assertEquals(shortvalue, shortresult);

    float floatvalue = new Random().nextFloat();
    GenericResponseParser<Float> fparser = new GenericResponseParser<Float>(Float.class);
    float floatresult = (Float) fparser.parseResponse(Float.toString(floatvalue).getBytes());
    assertEquals(String.valueOf(floatvalue), String.valueOf(floatresult));
    // use string as the value of the float

    double doublevalue = new Random().nextDouble();
    GenericResponseParser<Double> dparser = new GenericResponseParser<Double>(double.class);
    Double doubleresult = (Double) dparser.parseResponse(Double.toString(doublevalue).getBytes());
    assertEquals(String.valueOf(doublevalue), String.valueOf(doubleresult));

    byte bytevalue = Byte.MIN_VALUE + 10;
    GenericResponseParser<Byte> bparser = new GenericResponseParser<Byte>(Byte.class);
    Byte byteresult = (Byte) bparser.parseResponse(Byte.toString(bytevalue).getBytes());
    assertEquals(bytevalue, byteresult.byteValue());

}