Two methods of converting String to Long
1. Long.valueOf("String") returns the Long packaging type
2. Long.parseLong("String") returns the long basic data type
String type time to Long type timestamp
String time = "";
Long timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time).getTime();
Three methods of converting Long to String
1. Add an empty string directly at the end
long a = 123;
String s = a + "";
2、 String.valueof()
long a = 123;
String s =String.valueof(a) ;
3、 Long.toString()
long a = 123;
String s = Long.toString(a) ;