SHARE
TWEET

Untitled

a guest Oct 20th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.function.*;
  2.  
  3. public class NextEven {
  4.     public static void main(String... args) {
  5.        
  6.         LongUnaryOperator nextEven =
  7.             x -> ((++x & 1) == 0) ? x : ++x;
  8.  
  9.         System.out.printf("%d -> %d\n", 2, nextEven.applyAsLong(2));       
  10.         System.out.printf("%d -> %d\n", 317, nextEven.applyAsLong(317));       
  11.        
  12.         nextEven = a -> (a + 2) ^ ~(a + 1) + ;
  13.  
  14.         System.out.printf("%d -> %d\n", 2, nextEven.applyAsLong(2));       
  15.         System.out.printf("%d -> %d\n", 317, nextEven.applyAsLong(317));       
  16.     }
  17. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top