Commit cf50ae1c authored by Adam Knapp's avatar Adam Knapp Committed by Arpad Lovassy

Refactoring of digit array of BitstringUtilities

Signed-off-by: Adam Knapp's avatarAdam Knapp <adam.knapp@ericsson.com>
parent 7d32ed98
......@@ -13,7 +13,7 @@ package org.eclipse.titan.designer.AST.TTCN3.values.expressions;
* @author Kristof Szabados
* */
public final class BitstringUtilities {
public static final byte[] DIGITS = new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
private static final byte[] DIGITS = new byte[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
/** private constructor to disable instantiation */
private BitstringUtilities() {
......@@ -52,4 +52,12 @@ public final class BitstringUtilities {
return (byte) ('A' + value - 10);
}
/**
* Returns the array of digits
* @return returns the array of digits
*/
public static byte[] getDigitsArray() {
return DIGITS;
}
}
......@@ -268,9 +268,10 @@ public final class Int2HexExpression extends Expression_Value {
final StringBuilder builder = new StringBuilder(length);
final Integer_Value zero = new Integer_Value(Long.valueOf(0x0f));
final byte[] digits = BitstringUtilities.getDigitsArray();
Integer_Value temp = value;
for (int i = 1; i <= length; i++) {
builder.insert(0, (char) BitstringUtilities.DIGITS[(temp.and(zero)).intValue()]);
builder.insert(0, (char) digits[(temp.and(zero)).intValue()]);
temp = temp.shiftRight(4);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment