This file contains 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
int count = 100000000; | |
int hits = 0; | |
Random random = new Random(); | |
for (int i = 0; i < count; i++) { | |
final List<Integer> doors = new ArrayList<>(); | |
doors.add(0); | |
doors.add(1); | |
doors.add(2); |
This file contains 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
private static void rotate(int[] array, int r) { | |
reverse(array, 0, array.length); | |
reverse(array, 0, r); | |
reverse(array, r + 1, array.length); | |
} | |
private static void reverse(int[] array, int start, int end) { | |
while (start < end) { | |
swap(array, start, end); | |
start++; |
This file contains 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) { | |
Vector<Integer> v1 = new Vector<>(); | |
Vector<Integer> v2 = new Vector<>(); | |
Thread t1 = new Thread(new Runnable() { | |
@Override | |
public void run() { | |
int i = 0; | |
while(true) { | |
System.out.println("T1 try" + i); |
This file contains 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
package com.codlex.deximat.raf.third_year.web_programming.exam.project.part2.messages; | |
public enum CancelReservationResponse { | |
PASSENGER_DOESNT_EXIST("Reservation cancellation unssuccesful selected passinger doesn't exist."), | |
FLIGHT_DOESNT_EXIST("Reservation cancellation unssuccesful selected flight doesn't exist."), | |
RESERVATION_NOT_POSSIBLE_TOO_LATE("Reservations can't be canceled if flight is within next 24 hours."), | |
SUCCESS(null), | |
WRONG_FLIGHT("Reservation cancellation unssuccesful selected passinger isn't on flight."); | |
private String description; |
This file contains 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
package com.codlex.deximat.raf.third_year.web_programming.exam.project.part2.messages; | |
public enum CancelReservationResponse { | |
PASSENGER_DOESNT_EXIST("Reservation cancellation unssuccesful selected passinger doesn't exist."), | |
FLIGHT_DOESNT_EXIST("Reservation cancellation unssuccesful selected flight doesn't exist."), | |
RESERVATION_NOT_POSSIBLE_TOO_LATE("Reservations can't be canceled if flight is within next 24 hours."), | |
SUCCESS(null), | |
WRONG_FLIGHT("Reservation cancellation unssuccesful selected passinger isn't on flight."); | |
private String description; |