List of usage examples for java.lang Long parseLong
public static long parseLong(String s, int radix) throws NumberFormatException
From source file:Main.java
public static long ConvertMacToLong(String mac) { mac = mac.replace(":", ""); long id = Long.parseLong(mac, 16); return id;/*www . j av a 2 s. com*/ }
From source file:Main.java
public static String hexToRgb(int color) { int c = (int) Long.parseLong(color + "", 16); String r = ((c >> 16) & 0xFF) + ""; String g = ((c >> 8) & 0xFF) + ""; String b = ((c >> 0) & 0xFF) + ""; return r + g + b; }
From source file:Main.java
public static long parseIntHex(String data) { long value = Long.parseLong(data, 16); if (value > 0x7FFFFFFF) { value -= 0x100000000L;/*www .ja v a 2s . c o m*/ } return value; }
From source file:Main.java
public static long parseShortHex(String data) { long value = Long.parseLong(data, 16); if (value > 0x7FFF) { value -= 0x10000;/*from w ww . j a v a2s .c o m*/ } return value; }
From source file:Main.java
public static long parseInt5CharHex(String data) { long value = Long.parseLong(data, 16); if (value > 0x7FFFF) { value -= 0x100000L;//from ww w . j av a 2s. c o m } return value; }
From source file:Main.java
public static double String2AmountFloat(String str) { try {/*from ww w. j a v a2 s .c om*/ String tempStr = NumberFormat.getNumberInstance().format(Long.parseLong(str, 10)).replace(",", ""); return Long.parseLong(tempStr) / 100.00; } catch (Exception e) { e.printStackTrace(); return 0.00; } }
From source file:Main.java
public static long String2AmountFloat4QPOS(String str) { try {/*from w ww . j av a 2 s . com*/ String tempStr = NumberFormat.getNumberInstance().format(Long.parseLong(str, 10)).replace(",", ""); return Long.parseLong(tempStr); } catch (Exception e) { e.printStackTrace(); return 0; } }
From source file:Main.java
public static int argb(String hexColorCode) { if (hexColorCode.startsWith("#")) hexColorCode = hexColorCode.substring(1); return (int) Long.parseLong(hexColorCode, 16); }
From source file:Main.java
public static Long getLongAttr(final Node node, String attrName) { final String val = getAttr(node, attrName); return val == null ? null : Long.parseLong(val, 10); }
From source file:Main.java
private static boolean isHexadecimalColor(String colorString) { try {// ww w.java 2 s. c o m Long.parseLong(colorString.substring(1), 16); return true; } catch (NumberFormatException e) { return false; } }