Skip to content

Tag: decimal

Convert Decimal (Base 10) to Hexadecimal (Base 16) in Java

My question is about Java. How can I convert Decimal (Base 10) to Hexadecimal (Base 16) in Java with Java 7? When I use in C# the method Convert.FromBase64String(str) with String “BQoPFBke” i get the result: 05-0A-0F-14-19-1E But when I use in Java the method Base64.Decoder.decode(str) with the sa…

change binary to decimal

I have to write a method that changes binary to decimal. Write a method that will convert the supplied binary digit (as a string) to a decimal number. convertToDecimal(“01101011”) = 107 convertToDecimal(“00001011”) = 11 i have created it to change decimal to binary however im not sure …

Convert Decimal to Hex using Recursive method Java

I need to make a recursive method that converts a decimal into hexadecimal. I can’t use Integer.toHexString. EDIT:I tried this code but it doesn’t work properly Edit: Changed the default case and the if (n == 0) loop return statement and it works beautifully now. new code: Answer The problem is in…

Converting Decimal to Binary Java

I am trying to convert decimal to binary numbers from the user’s input using Java. I’m getting errors. How do I convert Decimal to Binary in Java? Answer Your binaryForm method is getting caught in an infinite recursion, you need to return if number <= 1: