Duration multipliedBy(long multiplicand) example
Description
Duration multipliedBy(long multiplicand)
returns a copy of this duration multiplied by the scalar.
Syntax
multipliedBy
has the following syntax.
public Duration multipliedBy(long multiplicand)
Example
The following example shows how to use multipliedBy
.
import java.time.Duration;
import java.time.LocalTime;
//from w ww . ja va 2 s . com
public class Main {
public static void main(String[] args) {
Duration duration = Duration.between(LocalTime.MIDNIGHT,LocalTime.NOON);
System.out.println(duration.getSeconds());
duration = duration.multipliedBy(2);
System.out.println(duration.getSeconds());
}
}
The code above generates the following result.