Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create BinarytoDecimal.java #1

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Create BinarytoDecimal.java #1

merged 1 commit into from
Oct 22, 2024

Conversation

PritamC20
Copy link
Owner

@PritamC20 PritamC20 commented Oct 22, 2024

Description:

Binary to Decimal conversion in java

Fixes #issue_number_here : Kavya-24#465

Type of change:

Provided source code

Checklist:

  • The idea is to extract the digits of a given binary number starting from the rightmost digit and keep a variable dec_value. At the time of extracting digits from the binary number, multiply the digit with the proper base (Power of 2) and add it to the variable dec_value. In the end, the variable dec_value will store the required decimal number.
    For Example:
    If the binary number is 111.
    dec_value = 1*(2^2) + 1*(2^1) + 1*(2^0) = 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant