List of usage examples for java.lang Integer toString
public String toString()
From source file:com.nridge.core.base.std.XMLUtl.java
public static void setAttrIntValue(Element anElement, String aName, int aValue) { Integer intObject; intObject = aValue;//from w w w . j a va 2 s. co m anElement.setAttribute(aName, intObject.toString()); }
From source file:com.payu.sdk.utils.SignUtil.java
/** * Creates the signature based on information received. * * @param key The merchant API Key// ww w . j av a 2s .co m * @param merchantId The merchant ID * @param referenceCode The reference * @param amount The payment amount * @param currency The currency * @return the signature created. */ public static String createSignature(final String key, final Integer merchantId, final String referenceCode, final String amount, final String currency) { return createSignature(Constants.ALGORITHM_MD5, key, buildMessage(merchantId.toString(), referenceCode, amount, currency)); }
From source file:io.undertow.server.handlers.proxy.mod_cluster.MCMPTestClient.java
static void addIfNotNull(final List<NameValuePair> pairs, final String key, final Integer value) { if (value != null) { pairs.add(new BasicNameValuePair(key, value.toString())); }/*from w w w . ja v a 2 s . co m*/ }
From source file:com.hotelbeds.hotelapimodel.auto.util.AssignUtils.java
public static String getString(final Integer number) { return number != null ? number.toString() : null; }
From source file:mitm.common.properties.HierarchicalPropertiesUtils.java
/** * Sets the integer property named propertyName. *//*from ww w .j ava2s . com*/ public static void setInteger(HierarchicalProperties properties, String propertyName, Integer value, boolean encrypt) throws HierarchicalPropertiesException { properties.setProperty(propertyName, value != null ? value.toString() : null, encrypt); }
From source file:org.openmrs.module.idcards.web.servlet.PrintEmptyIdcardsServlet.java
/** * Write the pdf to the given response/*from w ww. j a v a2 s .co m*/ * * @param card * @param baseURL * @param request * @param response * @param useGeneratedMRNs * @param password the password to encrypt the pdf with. If null, no encryption is done */ public static void generateOutput(IdcardsTemplate card, String baseURL, HttpServletResponse response, List<Integer> identifiers, String password) throws ServletException, IOException { // add check digits to the identifiers List<String> checkdigitedIdentifiers = new ArrayList<String>(identifiers.size()); try { for (Integer id : identifiers) { checkdigitedIdentifiers.add(id + "-" + IdcardsUtil.getCheckDigit(id.toString())); } } catch (Exception e) { throw new ServletException("Unable to generate check digit on given identifier", e); } generateOutputForIdentifiers(card, baseURL, response, checkdigitedIdentifiers, password); }
From source file:com.clustercontrol.repository.util.RepositoryUtil.java
/** * BigIntegerIP(IPv6)?????/*from w w w. ja va 2s. c o m*/ * @param argInt IPv6? * @return String */ public static String bigIntToIpV6(BigInteger argInt) { StringBuilder str = new StringBuilder(); for (int i = 15; i >= 0; i--) { int shift = 8 * i; Integer n = 0xff; BigInteger num = argInt.shiftRight(shift).and(new BigInteger(n.toString())); int intNum = num.intValue(); String s = Integer.toHexString(intNum); if (s.length() < 2) { s = "0" + s; } str.append(s); if (i > 0 && i < 15) { int f = i % 2; str.append(f == 0 ? ":" : ""); } } return str.toString(); }
From source file:org.osiam.tests.performance.tools.TestDataCreation.java
private static ByteBuffer getBigByteBuffer(Integer countCurrentUser) { String userId = countCurrentUser.toString(); byte[] bytes = new byte[userId.length() + MIN_COUNT_BYTE_BUFFER]; int actPosition; // first comes the id char[] userChars = userId.toCharArray(); for (int count = 0; count < userChars.length; count++) { bytes[count] = (byte) userChars[count]; }//from ww w. ja va 2s . c om actPosition = userChars.length; // now we add random bytes Random random = new Random(); String allowedChars = "0123456789abcdefghijklmnopqrstuvwxyz"; int max = allowedChars.length(); for (int i = 0; i < MIN_COUNT_BYTE_BUFFER; i++) { int value = random.nextInt(max); bytes[actPosition++] = (byte) allowedChars.charAt(value); } ByteBuffer ret = ByteBuffer.wrap(new byte[bytes.length]); ret.put(bytes); ret.flip(); return ret; }
From source file:com.idiro.utils.db.mysql.MySqlUtils.java
public static boolean importTable(JdbcConnection conn, String tableName, Map<String, String> features, File fileIn, File tablePath, char delimiter, boolean header) { boolean ok = true; try {/*from www . j av a 2s. c o m*/ DbChecker dbCh = new DbChecker(conn); if (!dbCh.isTableExist(tableName)) { logger.debug("The table which has to be imported has not been created"); logger.debug("Creation of the table"); Integer ASCIIVal = (int) delimiter; String[] options = { ASCIIVal.toString(), tablePath.getCanonicalPath() }; conn.executeQuery(new MySqlBasicStatement().createExternalTable(tableName, features, options)); } else { //Check if it is the same table if (!dbCh.areFeaturesTheSame(tableName, features.keySet())) { logger.warn("Mismatch between the table to import and the table in the database"); return false; } logger.warn("Have to check if the table is external or not, I do not know how to do that"); } } catch (SQLException e) { logger.debug("Fail to watch the datastore"); logger.debug(e.getMessage()); return false; } catch (IOException e) { logger.warn("Fail to get the output path from a File object"); logger.warn(e.getMessage()); return false; } //Check if the input file has the right number of field FileChecker fChIn = new FileChecker(fileIn); FileChecker fChOut = new FileChecker(tablePath); String strLine = ""; try { if (fChIn.isDirectory() || !fChIn.canRead()) { logger.warn("The file " + fChIn.getFilename() + "is a directory or can not be read"); return false; } BufferedReader br = new BufferedReader(new FileReader(fileIn)); //Read first line strLine = br.readLine(); br.close(); } catch (IOException e1) { logger.debug("Fail to open the file" + fChIn.getFilename()); return false; } if (StringUtils.countMatches(strLine, String.valueOf(delimiter)) != features.size() - 1) { logger.warn("File given does not match with the delimiter '" + delimiter + "' given and the number of fields '" + features.size() + "'"); return false; } BufferedWriter bw = null; BufferedReader br = null; try { bw = new BufferedWriter(new FileWriter(tablePath)); logger.debug("read the file" + fileIn.getAbsolutePath()); br = new BufferedReader(new FileReader(fileIn)); String delimiterStr = "" + delimiter; //Read File Line By Line while ((strLine = br.readLine()) != null) { bw.write("\"" + strLine.replace(delimiterStr, "\",\"") + "\"\n"); } br.close(); bw.close(); } catch (FileNotFoundException e1) { logger.error(e1.getCause() + " " + e1.getMessage()); logger.error("Fail to read " + fileIn.getAbsolutePath()); ok = false; } catch (IOException e1) { logger.error("Error writting, reading on the filesystem from the directory" + fChIn.getFilename() + " to the file " + fChOut.getFilename()); ok = false; } return ok; }
From source file:com.chiorichan.util.WebFunc.java
public static String createTable(Collection<Object> tableData, Collection<String> headerArray, String tableId, String altTableClass) {/*w w w .java2 s. co m*/ Map<Object, Object> newData = Maps.newLinkedHashMap(); Integer x = 0; for (Object o : tableData) { newData.put(x.toString(), o); x++; } return createTable(newData, headerArray, tableId, altTableClass); }