Java Utililty Methods Second

List of utility methods to do Second

  1. HOME
  2. Java
  3. S
  4. Second

Description

The list of methods to do Second are organized into topic(s).

Method

Date addSecond(Date beginDate, int addcount)
add Second
Calendar cal = Calendar.getInstance();
cal.setTime(beginDate);
cal.add(Calendar.SECOND, addcount);
Date enddate = cal.getTime();
return enddate;
Date addSeconds(Date date, int m)
add Seconds
return new Date(date.getTime() + m * 1000);
String addTimes(String dateTime, int second)
add Times
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
java.util.Date date1 = null;
try {
 date1 = format.parse(dateTime);
} catch (ParseException e) {
 e.printStackTrace();
long Time = (date1.getTime() / 1000) + second;
...
void advanceCurrentTimeSeconds()
Wait until the System#currentTimeMillis / 1000 advances.
long currentTimeSeconds = System.currentTimeMillis() / 1000;
do {
 Thread.sleep(50);
} while (currentTimeSeconds == System.currentTimeMillis() / 1000);
StringBuilder appendSeconds(StringBuilder time, long seconds)
append Seconds
if (seconds > 0) {
 if (seconds < 60) {
 time.append(seconds);
 } else {
 appendMinutes(time, seconds / 60);
 time.append(seconds % 60);
 time.append(" s ");
...
void appendSecondsToEncodeOutput(StringBuilder sb, int sec, int fsec, int precision, boolean fillzeros)
Append sections and fractional seconds (if any) at *cp.
if (fsec == 0) {
 if (fillzeros)
 sb.append(String.format("%02d", Math.abs(sec)));
 else
 sb.append(String.format("%d", Math.abs(sec)));
} else {
 if (fillzeros) {
 sb.append(String.format("%02d", Math.abs(sec)));
...
String asStringInSeconds(long duration)
as String In Seconds
long seconds = duration / 1000;
long milliSeconds = duration - (seconds * 1000);
return String.valueOf(seconds) + "." + asThreeDigits(milliSeconds);
long bytesPerSecond(long totalByteCount, long elapsed)
bytes Per Second
return (long) (((double) totalByteCount / (double) elapsed) * MILLIS);
int calculateSeconds(long duration)
calculate Seconds
return (int) duration / 1000;
Long countSecond(Long time)
count Second
return time / 1000;


AltStyle によって変換されたページ (->オリジナル) /