fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone {
  9. public static void main (String[] args) throws Exception {
  10. java.util.function.IntFunction f = n->"334130110314".charAt(n%12)-50;
  11. for (int i = 0; i < 12; i++) {
  12. System.out.printf("%d -> %d%n", i, f.apply(i));
  13. }
  14. }
  15. }
Success #stdin #stdout 0.08s 711680KB
stdin
Standard input is empty
stdout
0 -> 1
1 -> 1
2 -> 2
3 -> -1
4 -> 1
5 -> -2
6 -> -1
7 -> -1
8 -> -2
9 -> 1
10 -> -1
11 -> 2