This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To join list of srings on a delimiter | |
| List<String> l = new ArrayList<>(); | |
| String.join("+", l); | |
| // To split based on control character | |
| String[] strings = br.readLine().split("\\+"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Utils { | |
| public static long mulmod(long a, long b, long mod) { | |
| return (a * b) % mod; | |
| } | |
| public static long binpow(long a, long pow, long mod) { | |
| if (pow == 0) | |
| return 1; | |
| long res = binpow(a, pow / 2, mod); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void main(String[] args) throws IOException { | |
| BufferedReader br = new BufferedReader(new FileReader("PATH1")); | |
| int T = Integer.parseInt(br.readLine()); | |
| PrintWriter writer = new PrintWriter("PATH2", "UTF-8"); | |
| writer.println("Line"); | |
| writer.close(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| public class Scheduler { | |
| public static void main(String[] args) { | |
| private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); | |
| final Runnable ticker = new Runnable() { | |
| public void run() { | |
| System.out.println("Ran"); | |
| } | |
| }; |
OlderNewer