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:Main.java

public static void main(String[] args) {
    short sval = 50;

    System.out.println("Value of specified short is = " + Short.toString((short) sval));
}

From source file:Main.java

public static final String formatIPAddress(int ip) {
    short[] bytes = new short[] { (short) (ip & 0xff), (short) ((ip >> 8) & 0xff), (short) ((ip >> 16) & 0xff),
            (short) ((ip >> 24) & 0xff) };

    StringBuilder sb = new StringBuilder(16);
    for (int i = 0; i < bytes.length; i++) {
        if (i > 0)
            sb.append('.');
        sb.append(Short.toString(bytes[i]));
    }//from w ww .  ja  v a2 s.  c  o m
    return sb.toString();
}

From source file:net.floodlightcontroller.loadbalancer.LBMemberSerializer.java

@Override
public void serialize(LBMember member, JsonGenerator jGen, SerializerProvider serializer)
        throws IOException, JsonProcessingException {
    jGen.writeStartObject();//w  ww .  ja  v a 2  s.  c  o m

    jGen.writeStringField("id", member.id);
    jGen.writeStringField("address", String.valueOf(member.address));
    jGen.writeStringField("port", Short.toString(member.port));
    jGen.writeStringField("poolId", member.poolId);
    jGen.writeStringField("vipId", member.vipId);

    jGen.writeEndObject();
}

From source file:net.floodlightcontroller.loadbalancer.LBVipSerializer.java

@Override
public void serialize(LBVip vip, JsonGenerator jGen, SerializerProvider serializer)
        throws IOException, JsonProcessingException {
    jGen.writeStartObject();/*from   w  w  w . j  av a 2s  .c  om*/

    jGen.writeStringField("name", vip.name);
    jGen.writeStringField("id", vip.id);
    jGen.writeStringField("address", String.valueOf(vip.address));
    jGen.writeStringField("protocol", Byte.toString(vip.protocol));
    jGen.writeStringField("port", Short.toString(vip.port));

    jGen.writeEndObject();
}

From source file:jp.co.ntts.vhut.util.VhutUtil.java

/**
 * ????????.// w w  w .  j a  v  a 2s .  c om
 * @param prefix ??
 * @param vlan VLAN?
 * @return ??
 */
public static String createNetworkName(String prefix, short vlan) {
    String id = StringUtils.leftPad(Short.toString(vlan), 4, "0");
    return String.format("%s%s", prefix, id);
}

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

@Override
public void commit() throws InternalDatabaseException, InvalidParameterException, IOException {
    try {//from  w  w w  .ja v  a 2s.co  m
        List<BasicNameValuePair> params = new ArrayList<BasicNameValuePair>();
        params.add(new BasicNameValuePair("wifi", Short.toString(this.wifiCount)));
        params.add(new BasicNameValuePair("bluetooth", Short.toString(this.bluetoothCount)));
        super.service.requestPostService("update_connection.php", params);
    } catch (JSONException e) {
        throw new IOException("Server returned no valid JSON object: " + e);
    }
}

From source file:byps.BBufferJson.java

public void putShort(short v) {
    putJsonValueAscii(null, Short.toString(v), STRING_WITHOUT_QUOTE);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmMssCF.CFCrmMssCFBindISOCountryId.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFCrmMssCFBindISOCountryId.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }/*w  w w . ja  va2 s.c  om*/

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFCrmISOCountryObj) {
        short id = ((ICFCrmISOCountryObj) genDef).getRequiredId();
        ret = Short.toString(id);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFCrmISOCountryObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmMssCF.CFCrmMssCFBindISOCurrencyId.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFCrmMssCFBindISOCurrencyId.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }//w  ww.j a v  a  2s .c  om

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFCrmISOCurrencyObj) {
        short id = ((ICFCrmISOCurrencyObj) genDef).getRequiredId();
        ret = Short.toString(id);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFCrmISOCurrencyObj");
    }

    return (ret);
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmMssCF.CFCrmMssCFBindISOLanguageId.java

public String expandBody(MssCFGenContext genContext) {
    final String S_ProcName = "CFCrmMssCFBindISOLanguageId.expandBody() ";

    if (genContext == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext");
    }// w  ww  .j av a  2  s .c o m

    ICFLibAnyObj genDef = genContext.getGenDef();
    if (genDef == null) {
        throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), "expandBody", 1,
                "genContext.getGenDef()");
    }

    String ret;

    if (genDef instanceof ICFCrmISOLanguageObj) {
        short id = ((ICFCrmISOLanguageObj) genDef).getRequiredId();
        ret = Short.toString(id);
    } else {
        throw CFLib.getDefaultExceptionFactory().newUnsupportedClassException(getClass(), "expandBody",
                "genContext.getGenDef()", genDef, "ICFCrmISOLanguageObj");
    }

    return (ret);
}