From 4bc28b5d372e542d5fd75471accbdbfb14c6e17c Mon Sep 17 00:00:00 2001 From: Chris Stewart Date: Sun, 21 Feb 2016 21:31:15 -0600 Subject: [PATCH] Adding some scaladocs for util functions --- .../scala/org/scalacoin/util/NumberUtil.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/main/scala/org/scalacoin/util/NumberUtil.scala b/src/main/scala/org/scalacoin/util/NumberUtil.scala index 55feee20ce..674e7414d3 100644 --- a/src/main/scala/org/scalacoin/util/NumberUtil.scala +++ b/src/main/scala/org/scalacoin/util/NumberUtil.scala @@ -11,8 +11,21 @@ trait NumberUtil { private def logger = LoggerFactory.getLogger(this.getClass()) + + /** + * Takes a hex number and converts it into a signed number + * used in the bitcoin numbering system + * @param hex + * @return + */ def toLong(hex : String) : Long = toLong(ScalacoinUtil.decodeHex(hex)) + /** + * Takes a list of bytes and converts it in to signed number inside of bitcoins + * numbering system + * @param bytes + * @return + */ def toLong(bytes : List[Byte]) : Long = { logger.debug("bytes: " + bytes) val reversedBytes = bytes.reverse @@ -32,6 +45,11 @@ trait NumberUtil { } + /** + * Converts a long number to a signed number hex representation + * @param long + * @return + */ def longToHex(long : Long) : String = { if (long > -1) { val bytes = toByteList(long)