@Test public void test() { assertEquals("0xffff", IntAnnotation.getShortInteger(0xffff)); assertEquals("0x1ffff", IntAnnotation.getShortInteger(0x1ffff)); assertEquals("0x1fffffff", IntAnnotation.getShortInteger(0x1fffffff)); assertEquals("0x7fffffff", IntAnnotation.getShortInteger(0x7fffffff)); assertEquals("15", IntAnnotation.getShortInteger(15)); assertEquals("255", IntAnnotation.getShortInteger(255)); assertEquals("-1", IntAnnotation.getShortInteger(-1)); assertEquals("-2", IntAnnotation.getShortInteger(-2)); assertEquals("0xffffffff", IntAnnotation.getShortInteger(0xffffffffL)); assertEquals("0x1ffffffff", IntAnnotation.getShortInteger(0x1ffffffffL)); assertEquals("0xfffffffff", IntAnnotation.getShortInteger(0xfffffffffL)); }
public static String getShortInteger(int value) { String base16 = Integer.toHexString(value); int unique = uniqueDigits(base16); String base10 = Integer.toString(value); if (unique <= 3 && base16.length() - unique >= 3 && base10.length() > base16.length()) { return "0x" + base16; } return base10; }
IntAnnotation implements BugAnnotation { public static String getShortInteger(int value) { String base16 = Integer.toHexString(value); int unique = uniqueDigits(base16); String base10 = Integer.toString(value); if (unique <= 3 && base16.length() - unique >= 3 && base10.length() > base16.length()) { return "0x" + base16; } return base10; } }
IntAnnotation implements BugAnnotation { public static String getShortInteger(int value) { String base16 = Integer.toHexString(value); int unique = uniqueDigits(base16); String base10 = Integer.toString(value); if (unique <= 3 && base16.length() - unique >= 3 && base10.length() > base16.length()) { return "0x" + base16; } return base10; } IntAnnotation(int value); }
IntAnnotation implements BugAnnotation { public static String getShortInteger(int value) { String base16 = Integer.toHexString(value); int unique = uniqueDigits(base16); String base10 = Integer.toString(value); if (unique <= 3 && base16.length() - unique >= 3 && base10.length() > base16.length()) { return "0x" + base16; } return base10; } IntAnnotation(int value); @Override Object clone(); int getValue(); @Override void accept(BugAnnotationVisitor visitor); @Override String format(String key, ClassAnnotation primaryClass); static String getShortInteger(int value); static String getShortInteger(long value); @Override void setDescription(String description); @Override String getDescription(); @Override int hashCode(); @Override boolean equals(Object o); @Override int compareTo(BugAnnotation o); @Override String toString(); @Override void writeXML(XMLOutput xmlOutput); @Override void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary); @Override boolean isSignificant(); @Override String toString(ClassAnnotation primaryClass); }
IntAnnotation implements BugAnnotation { public static String getShortInteger(int value) { String base16 = Integer.toHexString(value); int unique = uniqueDigits(base16); String base10 = Integer.toString(value); if (unique <= 3 && base16.length() - unique >= 3 && base10.length() > base16.length()) { return "0x" + base16; } return base10; } IntAnnotation(int value); @Override Object clone(); int getValue(); @Override void accept(BugAnnotationVisitor visitor); @Override String format(String key, ClassAnnotation primaryClass); static String getShortInteger(int value); static String getShortInteger(long value); @Override void setDescription(String description); @Override String getDescription(); @Override int hashCode(); @Override boolean equals(Object o); @Override int compareTo(BugAnnotation o); @Override String toString(); @Override void writeXML(XMLOutput xmlOutput); @Override void writeXML(XMLOutput xmlOutput, boolean addMessages, boolean isPrimary); @Override boolean isSignificant(); @Override String toString(ClassAnnotation primaryClass); static final String INT_SYNC_PERCENT; static final String INT_OCCURRENCES; static final String INT_VALUE; static final String INT_MIN_VALUE; static final String INT_MAX_VALUE; static final String INT_SHIFT; static final String INT_EXPECTED_ARGUMENTS; static final String INT_ACTUAL_ARGUMENTS; static final String INT_OBLIGATIONS_REMAINING; }