diff --git a/src/main/java/com/adventofcode/flashk/common/Array2DUtil.java b/src/main/java/com/adventofcode/flashk/common/Array2DUtil.java index 22543f3..d1ba97d 100644 --- a/src/main/java/com/adventofcode/flashk/common/Array2DUtil.java +++ b/src/main/java/com/adventofcode/flashk/common/Array2DUtil.java @@ -4,11 +4,9 @@ public class Array2DUtil { private Array2DUtil() {} - /** - * Transposes the given 2D array. - * @param array the array to transpose. - * @return a new 2D array that is the transpose of the given array. - */ + /// Transposes the given 2D array. + /// @param array the array to transpose. + /// @return a new 2D char array that is the transpose of the given array. public static char[][] transpose(char[][] array) { int rows = array.length; int cols = array[0].length; @@ -21,10 +19,8 @@ public static char[][] transpose(char[][] array) { return transposedArray; } - /** - * Paints the given array. - * @param map the array to paint - */ + /// Paints the given 2D array. + /// @param map the array to paint. public static void paint(char[][] map) { System.out.println(); diff --git a/src/main/java/com/adventofcode/flashk/common/BaseUtil.java b/src/main/java/com/adventofcode/flashk/common/BaseUtil.java index 0db7a75..08843f3 100644 --- a/src/main/java/com/adventofcode/flashk/common/BaseUtil.java +++ b/src/main/java/com/adventofcode/flashk/common/BaseUtil.java @@ -13,49 +13,41 @@ public static Integer binaryToDecInteger(String bin) { public static Long binaryToDec(String bin) { return Long.parseLong(bin, 2); } - - /** - * Converts from hexadecimal to binary. - *
- * Any hexadecimal number can be represented with 4 binary digits (6 hex = 0110 bin
).
- *
- * Leading zero digits won't be included in the converted number. - * Use {@link #hexToBinaryPadLeft(String)} if they need to be included. - *
- *- * Examples: - *
- *- * BaseUtil.hexToBinary("6") = "110" - *- * @param hex the hexadecimal code - * @return the translated binary code - * @see #hexToBinaryPadLeft(String) - */ + + /// Converts from hexadecimal to binary. + /// + /// Any hexadecimal number can be represented with 4 binary digits (`6 hex = 0110 bin`). + /// + /// Leading zero digits won't be included in the converted number. + /// Use [hexToBinaryPadLeft][#hexToBinaryPadLeft(String)] if they need to be included. + /// + /// **Examples:** + /// + /// ```java + /// BaseUtil.hexToBinary("6") // returns "110" + /// ``` + /// @param hex the hexadecimal code + /// @return the translated binary code + /// @see #hexToBinaryPadLeft(String) public static String hexToBinary(String hex) { return new BigInteger(hex, 16).toString(2); } - - /** - * Converts from hexadecimal to binary and adds zero padding at the leading. - *
- * Any hexadecimal number can be represented with 4 binary digits (6 hex = 0110 bin
).
- *
- * Examples: - *
- *- * BaseUtil.hexToBinaryPadLeft("6") = "0110" - *- * @param hex the hexadecimal code - * @return the translated binary code, it will always have a multiple of 4 digits. - * @see #hexToBinary(String) - */ + + /// Converts from hexadecimal to binary and adds zero padding at the leading. + /// + /// Any hexadecimal number can be represented with 4 binary digits (`6 hex = 0110 bin`). + /// + /// Leading zero digits will be included in the converted number. + /// Use [hexToBinary][#hexToBinary(String)] if they need to be removed from the result. + /// + /// **Examples:** + /// + /// ```java + /// BaseUtil.hexToBinaryPadLeft("6"); // returns "0110" + /// ``` + /// @param hex the hexadecimal code + /// @return the translated binary code, it will always have a multiple of 4 digits. + /// @see #hexToBinary(String) public static String hexToBinaryPadLeft(String hex) { String unpaddedBinary = BaseUtil.hexToBinary(hex); int size = hex.length() * 4;