From 61aaa5925fcf65c310cd2ece8af39ebe79d1cea7 Mon Sep 17 00:00:00 2001 From: The-TJ <32796932+The-TJ@users.noreply.github.com> Date: Wed, 22 Nov 2017 17:38:51 +0000 Subject: [PATCH] Update HexToOct.java --- Conversions/HexToOct.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Conversions/HexToOct.java b/Conversions/HexToOct.java index 7d5579ff..275fe84e 100644 --- a/Conversions/HexToOct.java +++ b/Conversions/HexToOct.java @@ -4,7 +4,8 @@ Author - Tanmay Joshi*/ import java.util.Scanner; public class HexToOct -{ +{ + //Function that takes the Hexadecimal number as input and returns the decimal form. public static int hex2decimal(String s) { String str = "0123456789ABCDEF"; @@ -17,7 +18,8 @@ public class HexToOct val = 16*val + n; } return val; - } + } + // Main function that gets the hex input from user and converts it into octal. public static void main(String args[]) { String hexadecnum; @@ -39,7 +41,7 @@ public class HexToOct octnum[i++] = decnum%8; decnum = decnum/8; } - + //Print the octal form of the number. System.out.print("Equivalent Octal Number is :\n"); for(j=i-1; j>0; j--) {