aboutsummaryrefslogtreecommitdiff
path: root/challenge-120
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-120')
-rw-r--r--challenge-120/frankivo/scala/BinarySwap.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-120/frankivo/scala/BinarySwap.scala b/challenge-120/frankivo/scala/BinarySwap.scala
new file mode 100644
index 0000000000..ff11db8964
--- /dev/null
+++ b/challenge-120/frankivo/scala/BinarySwap.scala
@@ -0,0 +1,11 @@
+object BinarySwap {
+ def Swap(n: Int): Int = {
+ Integer.parseInt(
+ "%08d"
+ .format(n.toBinaryString.toInt)
+ .grouped(2)
+ .map(_.reverse)
+ .mkString,
+ 2)
+ }
+} \ No newline at end of file