1 package net.mograsim.logic.ui.am2900;
3 public final class TestUtil
11 * Transforms the last four bits of an int to a string that contains the binary ('1' and '0') representation of the 4 bits
13 public static String to4bitBin(int x)
15 StringBuilder sb = new StringBuilder(4);
16 sb.append((x & 0b1000) == 0 ? '0' : '1');
17 sb.append((x & 0b0100) == 0 ? '0' : '1');
18 sb.append((x & 0b0010) == 0 ? '0' : '1');
19 sb.append((x & 0b0001) == 0 ? '0' : '1');