List of usage examples for java.lang Long parseLong
public static long parseLong(String s) throws NumberFormatException
From source file:Main.java
public static long CompareMilliTimeDelta(String arrivalTime) { Calendar calendarToday = Calendar.getInstance(); long millisecondsCurrent = calendarToday.getTimeInMillis(); return millisecondsCurrent - Long.parseLong(arrivalTime); }
From source file:Main.java
/** * @param time//from w ww .j a v a 2 s . c o m * @return */ public static String timeToChange(String time) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); return simpleDateFormat.format(new Date(Long.parseLong(time + "000"))); }
From source file:Main.java
public static long[] parseLongIDs(String delimitedIDs, String delimiter) { final String[] split = delimitedIDs.split(delimiter); final long[] idArray = new long[split.length]; for (int i = 0; i < split.length; i++) idArray[i] = Long.parseLong(split[i]); return idArray; }
From source file:Main.java
public static long toDate(long millis) { Date currentTime = new Date(); currentTime.setTime(millis);//from w w w .jav a2 s .co m SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); return Long.parseLong(formatter.format(currentTime)); }
From source file:Main.java
public static String byte2Common(Context context, String fsize) { if (TextUtils.isEmpty(fsize)) { return ""; }/* w ww .j av a 2 s. c om*/ Long sizeLong = Long.parseLong(fsize); return Formatter.formatFileSize(context, sizeLong); }
From source file:Main.java
public static long readSubNodeLongValue(Node n, String name, long dflt) { if (name == null) return dflt; for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) if (name.equalsIgnoreCase(d.getNodeName())) return Long.parseLong(d.getNodeValue()); return dflt;//from www .j ava2 s. co m }
From source file:Main.java
private static String getCSTimeString(String timestamp) { return simpleDateFormat.format(new Timestamp(Long.parseLong(timestamp) * 1000)); }
From source file:Main.java
public static long readLongFromStdin(String message) throws Exception { String tmp = readStringFromStdin(message); return Long.parseLong(tmp); }
From source file:Main.java
public static long readLong(StringReader reader, char delimiter) throws NumberFormatException { String str = readString(reader, delimiter); if (str.length() == 0) { return 0; } else {/* w w w. ja va 2 s.com*/ return Long.parseLong(str); } }
From source file:Main.java
public static long getAttributeLongValue(Node n, String item, long dflt) { final Node d = n.getAttributes().getNamedItem(item); if (d == null) return dflt; final String val = d.getNodeValue(); if (val == null) return dflt; return Long.parseLong(val); }