Example usage for java.lang Integer toString

List of usage examples for java.lang Integer toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

Returns a String object representing this Integer 's value.

Usage

From source file:com.kstenschke.hourscalculator.utils.UtilsPreferences.java

/**
 * @param idDialog//from w ww.  j a v a 2 s.  c  o  m
 * @param x
 * @param y
 */
public static void saveDialogPosition(String idDialog, Integer x, Integer y) {
    PropertiesComponent.getInstance().setValue(idDialog + ".Position", x.toString() + "x" + y.toString());
}

From source file:com.autentia.wuija.trace.persistence.OperationalTraceBuilder.java

public static OperationalTraceParams generateParam(String paramName, Operator operator, Integer param) {
    return generateParam(paramName, operator, param.toString());
}

From source file:SampleGet.java

static void printHeight(Rectangle r) {
    Field heightField;/*from w ww.  j a v a  2 s.co m*/
    Integer heightValue;
    Class c = r.getClass();
    try {
        heightField = c.getField("height");
        heightValue = (Integer) heightField.get(r);
        System.out.println("Height: " + heightValue.toString());
    } catch (NoSuchFieldException e) {
        System.out.println(e);
    } catch (SecurityException e) {
        System.out.println(e);
    } catch (IllegalAccessException e) {
        System.out.println(e);
    }
}

From source file:Main.java

private static void addCount(Activity activity, Integer count, LinearLayout layout, String label) {
    if (count != null && count > 0) {
        TextView amt = new TextView(activity);
        amt.setTextSize(textSize);//from  w  ww. j a  v a  2  s  .  c  om
        amt.setText(count.toString() + " " + label + "  ");
        layout.addView(amt);
    }
}

From source file:com.qcadoo.model.api.utils.TreeNumberingServiceImpl.java

public static void incrementLastChainNumber(final Deque<String> chain) {
    Integer nextNumber = Integer.valueOf(chain.pollLast()) + 1;
    chain.addLast(nextNumber.toString());
}

From source file:geotag.example.sbickt.SbicktAPI.java

public static void deleteGeoTag(Integer geoTagId) throws Exception {
    String url = Properties.getUrlIndex();
    HttpHelper httpConnection = HttpHelper.getInstance(url, geoTagId.toString());

    if (!httpConnection.DELETERequest()) {
        throw new Exception("SbicktAPI -> deleteGeoTag: Failed to delete geotag");
    }// w w w  .  j a v  a2 s.c o m
}

From source file:msuresh.raftdistdb.RaftClient.java

public static void SetValue(String name, String key, String value) throws FileNotFoundException {
    if (key == null || key.isEmpty()) {
        return;/*  ww  w  .jav  a 2 s . c  om*/
    }
    File configFile = new File(Constants.STATE_LOCATION + name + ".info");
    if (!configFile.exists() || configFile.isDirectory()) {
        FileNotFoundException ex = new FileNotFoundException();
        throw ex;
    }
    try {
        System.out.println("Adding key .. hold on..");
        String content = new Scanner(configFile).useDelimiter("\\Z").next();
        JSONObject config = (JSONObject) (new JSONParser()).parse(content);
        Long numPart = (Long) config.get("countPartitions");
        Integer shardId = key.hashCode() % numPart.intValue();
        JSONArray memberJson = (JSONArray) config.get(shardId.toString());
        List<Address> members = new ArrayList<>();
        for (int i = 0; i < memberJson.size(); i++) {
            JSONObject obj = (JSONObject) memberJson.get(i);
            Long port = (Long) obj.get("port");
            String address = (String) obj.get("address");
            members.add(new Address(address, port.intValue()));
        }
        CopycatClient client = CopycatClient.builder(members).withTransport(new NettyTransport()).build();
        client.open().join();
        client.submit(new PutCommand(key, value)).get();
        client.close().join();
        while (client.isOpen()) {
            Thread.sleep(1000);
        }
        System.out.println("key " + key + " with value : " + value + " has been added to the cluster");
    } catch (Exception ex) {
        System.out.println(ex.toString());
    }
}

From source file:msuresh.raftdistdb.RaftClient.java

public static void GetValue(String name, String key) throws FileNotFoundException {
    if (key == null || key.isEmpty()) {
        return;//  w ww  .jav  a2s  .co m
    }
    File configFile = new File(Constants.STATE_LOCATION + name + ".info");
    if (!configFile.exists() || configFile.isDirectory()) {
        FileNotFoundException ex = new FileNotFoundException();
        throw ex;
    }
    try {
        System.out.println("Getting key .. Hold on.");
        String content = new Scanner(configFile).useDelimiter("\\Z").next();
        JSONObject config = (JSONObject) (new JSONParser()).parse(content);
        Long numPart = (Long) config.get("countPartitions");
        Integer shardId = key.hashCode() % numPart.intValue();
        JSONArray memberJson = (JSONArray) config.get(shardId.toString());
        List<Address> members = new ArrayList<>();
        for (int i = 0; i < memberJson.size(); i++) {
            JSONObject obj = (JSONObject) memberJson.get(i);
            Long port = (Long) obj.get("port");
            String address = (String) obj.get("address");
            members.add(new Address(address, port.intValue()));
        }
        CopycatClient client = CopycatClient.builder(members).withTransport(new NettyTransport()).build();
        client.open().join();
        Object str = client.submit(new GetQuery(key)).get();
        System.out.println("For the key : " + key + ", the database returned the value : " + (String) str);
        client.close().join();
        while (client.isOpen()) {
            Thread.sleep(1000);
        }
    } catch (Exception ex) {
        System.out.println(ex.toString());
    }
}

From source file:es.emergya.consultas.RecursoConsultas.java

public static boolean alreadyExists(Integer integer) {
    return (getbyDispositivo(integer.toString()) != null);
}

From source file:com.genentech.chemistry.openEye.apps.SDFTorsionScanner.java

/**
 * Set the title and index on the molecule
 * @param mol//ww w.ja  v  a  2 s .  co  m
 * @param nMolIndex
 */
private static void setMolIndex(OEGraphMol mol, Integer nMolIndex) {
    mol.SetTitle("Molecule_" + nMolIndex.toString());

    // Set tor mol num sd tag
    oechem.OESetSDData(mol, TORMOLNUM_TAG, nMolIndex.toString());
}