|
| 1 | +public class Test { |
| 2 | + public String det() |
| 3 | + { |
| 4 | + StringBuilder builder = new StringBuilder("abcdefghijklmnopqrstuvwxyz"); |
| 5 | + builder.setCharAt(3, '!'); |
| 6 | + builder.setCharAt(5, '!'); |
| 7 | + builder.setCharAt(7, '!'); |
| 8 | + builder.setCharAt(9, '!'); |
| 9 | + builder.setCharAt(13, '!'); |
| 10 | + builder.setCharAt(15, '!'); |
| 11 | + builder.setCharAt(17, '!'); |
| 12 | + builder.setCharAt(19, '!'); |
| 13 | + builder.setCharAt(4, ':'); |
| 14 | + builder.setCharAt(5, ':'); |
| 15 | + builder.setCharAt(6, ':'); |
| 16 | + builder.setCharAt(9, ':'); |
| 17 | + builder.setCharAt(10, ':'); |
| 18 | + builder.setCharAt(11, ':'); |
| 19 | + builder.setCharAt(16, ':'); |
| 20 | + builder.setCharAt(18, ':'); |
| 21 | + return builder.toString(); |
| 22 | + } |
| 23 | + |
| 24 | + public String nonDet(String s, char c, int i) |
| 25 | + { |
| 26 | + StringBuilder builder = new StringBuilder(s); |
| 27 | + if(i + 5 >= s.length() || 19 >= s.length() || i < 0) |
| 28 | + return "Out of bounds"; |
| 29 | + builder.setCharAt(i, c); |
| 30 | + builder.setCharAt(i+5, 'x'); |
| 31 | + builder.setCharAt(7, '!'); |
| 32 | + builder.setCharAt(9, '!'); |
| 33 | + builder.setCharAt(13, '!'); |
| 34 | + builder.setCharAt(15, '!'); |
| 35 | + builder.setCharAt(17, '!'); |
| 36 | + builder.setCharAt(19, '!'); |
| 37 | + builder.setCharAt(4, ':'); |
| 38 | + builder.setCharAt(5, ':'); |
| 39 | + builder.setCharAt(6, c); |
| 40 | + builder.setCharAt(9, ':'); |
| 41 | + builder.setCharAt(10, ':'); |
| 42 | + builder.setCharAt(11, ':'); |
| 43 | + builder.setCharAt(16, ':'); |
| 44 | + builder.setCharAt(18, ':'); |
| 45 | + return builder.toString(); |
| 46 | + } |
| 47 | + |
| 48 | + public String withDependency(boolean b) |
| 49 | + { |
| 50 | + StringBuilder builder = new StringBuilder("abcdefghijklmnopqrstuvwxyz"); |
| 51 | + builder.setCharAt(3, '!'); |
| 52 | + builder.setCharAt(5, '!'); |
| 53 | + |
| 54 | + if(b) { |
| 55 | + assert builder.toString().startsWith("abc!"); |
| 56 | + } else { |
| 57 | + assert !builder.toString().startsWith("abc!"); |
| 58 | + } |
| 59 | + return builder.toString(); |
| 60 | + } |
| 61 | + |
| 62 | +} |
0 commit comments