René's URL Explorer Experiment


Title: fix(conversions): reject non-hex digits in HexToOct.hexToDecimal by kevin9327 · Pull Request #7748 · TheAlgorithms/Java · GitHub

Open Graph Title: fix(conversions): reject non-hex digits in HexToOct.hexToDecimal by kevin9327 · Pull Request #7748 · TheAlgorithms/Java

X Title: fix(conversions): reject non-hex digits in HexToOct.hexToDecimal by kevin9327 · Pull Request #7748 · TheAlgorithms/Java

Description: HexToOct.hexToDecimal looks each character up with indexOf and uses the result directly, so a character that is not a hex digit adds -1 instead of failing. The method then returns a wrong number with no error: hexToDecimal("1G") returns 15 (16 * 1 + -1) hexToDecimal("0x1A") returns -230 hexToOctal("Z") returns 0 (the -1 makes decimalToOctal skip its loop) This change throws IllegalArgumentException for any character outside 0-9A-F (after the existing upper-casing), matching what OctalToHexadecimal.octalToDecimal already does for bad octal digits. Valid inputs give the same results as before. HexToOctTest.testInvalidHexDigitThrows covers the three inputs above. It fails on master and passes with this change; the existing tests still pass. I have read CONTRIBUTING.md. This pull request is all my own work -- I have not plagiarized it. All filenames are in PascalCase. All functions and variable names follow Java naming conventions. All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations. (no new algorithm) All new algorithms include a corresponding test class that validates their functionality. (test added to the existing class) All new code is formatted with clang-format -i --style=file path/to/your/file.java I used an AI assistant while preparing this change; I reviewed the code and ran the tests myself.

Open Graph Description: HexToOct.hexToDecimal looks each character up with indexOf and uses the result directly, so a character that is not a hex digit adds -1 instead of failing. The method then returns a wrong number wi...

X Description: HexToOct.hexToDecimal looks each character up with indexOf and uses the result directly, so a character that is not a hex digit adds -1 instead of failing. The method then returns a wrong number wi...

Opengraph URL: https://github.com/TheAlgorithms/Java/pull/7748

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:378aa0c8-6dfe-2516-3ceb-4f8568a8e6c0
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC050:3BB1C6:23B1A05:31E6E4D:6AFA973B
html-safe-nonce2a0edfe35baf033de7c0b675aa2838a07e98b711e60312ef2e59f2bf167cbe65
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDUwOjNCQjFDNjoyM0IxQTA1OjMxRTZFNEQ6NkFGQTk3M0IiLCJ2aXNpdG9yX2lkIjoiMTkxODA4NzA2NzEwMzU2NTYyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb7b905d4cef08785287e37a1e519d6bc1a7ba967d3bb157d1b47cfdc2f21eb6b
hovercard-subject-tagpull_request:5265487162
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/TheAlgorithms/Java/pull/7748/files
twitter:imagehttps://avatars.githubusercontent.com/u/5299031?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/5299031?s=400&v=4
og:image:altHexToOct.hexToDecimal looks each character up with indexOf and uses the result directly, so a character that is not a hex digit adds -1 instead of failing. The method then returns a wrong number wi...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/TheAlgorithms/Java git https://github.com/TheAlgorithms/Java.git
octolytics-dimension-user_id20487725
octolytics-dimension-user_loginTheAlgorithms
octolytics-dimension-repository_id63477660
octolytics-dimension-repository_nwoTheAlgorithms/Java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id63477660
octolytics-dimension-repository_network_root_nwoTheAlgorithms/Java
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release072e34035c13c31543fba9f025cbbbda4210dae4
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/TheAlgorithms/Java/pull/7748/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJava%2Fpull%2F7748%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FTheAlgorithms%2FJava%2Fpull%2F7748%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=TheAlgorithms%2FJava
Reloadhttps://github.com/TheAlgorithms/Java/pull/7748/files
Reloadhttps://github.com/TheAlgorithms/Java/pull/7748/files
Reloadhttps://github.com/TheAlgorithms/Java/pull/7748/files
TheAlgorithmshttps://github.com/TheAlgorithms
Javahttps://github.com/TheAlgorithms/Java
Codehttps://github.com/TheAlgorithms/Java
Issues3 (3)https://github.com/TheAlgorithms/Java/issues
Pull requests17 (17)https://github.com/TheAlgorithms/Java/pulls
Actionshttps://github.com/TheAlgorithms/Java/actions
Security and qualityhttps://github.com/TheAlgorithms/Java/security
Insightshttps://github.com/TheAlgorithms/Java/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FTheAlgorithms%2FJava%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FTheAlgorithms%2FJava%2Fissues%2Fnew%2Fchoose
alxkmhttps://github.com/alxkm
TheAlgorithms:masterhttps://github.com/TheAlgorithms/Java/tree/master
kevin9327:fix/hextooct-invalid-digithttps://github.com/kevin9327/Java/tree/fix/hextooct-invalid-digit
Conversation 2 https://github.com/TheAlgorithms/Java/pull/7748
Commits 1 https://github.com/TheAlgorithms/Java/pull/7748/commits
Checks 7 https://github.com/TheAlgorithms/Java/pull/7748/checks
Files changed https://github.com/TheAlgorithms/Java/pull/7748/files
Please reload this pagehttps://github.com/TheAlgorithms/Java/pull/7748/files
fix(conversions): reject non-hex digits in HexToOct.hexToDecimal https://github.com/TheAlgorithms/Java/pull/7748/files#top
Show all changes 1 commit https://github.com/TheAlgorithms/Java/pull/7748/files
91ad22a fix(conversions): reject non-hex digits in HexToOct.hexToDecimal kevin9327 Nov 11, 2026 https://github.com/TheAlgorithms/Java/pull/7748/commits/91ad22a010c328c6701244269a458765dc725599
Clear filters https://github.com/TheAlgorithms/Java/pull/7748/files
Please reload this pagehttps://github.com/TheAlgorithms/Java/pull/7748/files
Please reload this pagehttps://github.com/TheAlgorithms/Java/pull/7748/files
HexToOct.java https://github.com/TheAlgorithms/Java/pull/7748/files#diff-7f9fc331691e5fa7762fc694e0781e11034f8987b0e801d3e5f2b8416a7c87b6
HexToOctTest.java https://github.com/TheAlgorithms/Java/pull/7748/files#diff-3dd198ff1bda758d5b9edaf73371aafe69e8c8b0ff2399e0ffaf0d89e86e38d1
https://github.com/TheAlgorithms/Java/blob/master/.github/CODEOWNERS#L1
src/main/java/com/thealgorithms/conversions/HexToOct.javahttps://github.com/TheAlgorithms/Java/pull/7748/files#diff-7f9fc331691e5fa7762fc694e0781e11034f8987b0e801d3e5f2b8416a7c87b6
View file https://github.com/kevin9327/Java/blob/91ad22a010c328c6701244269a458765dc725599/src/main/java/com/thealgorithms/conversions/HexToOct.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/TheAlgorithms/Java/pull/7748/{{ revealButtonHref }}
https://github.com/TheAlgorithms/Java/pull/7748/files#diff-7f9fc331691e5fa7762fc694e0781e11034f8987b0e801d3e5f2b8416a7c87b6
https://github.com/TheAlgorithms/Java/pull/7748/files#diff-7f9fc331691e5fa7762fc694e0781e11034f8987b0e801d3e5f2b8416a7c87b6
https://github.com/TheAlgorithms/Java/pull/7748/files#diff-7f9fc331691e5fa7762fc694e0781e11034f8987b0e801d3e5f2b8416a7c87b6
https://github.com/TheAlgorithms/Java/blob/master/.github/CODEOWNERS#L1
src/test/java/com/thealgorithms/conversions/HexToOctTest.javahttps://github.com/TheAlgorithms/Java/pull/7748/files#diff-3dd198ff1bda758d5b9edaf73371aafe69e8c8b0ff2399e0ffaf0d89e86e38d1
View file https://github.com/kevin9327/Java/blob/91ad22a010c328c6701244269a458765dc725599/src/test/java/com/thealgorithms/conversions/HexToOctTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/TheAlgorithms/Java/pull/7748/{{ revealButtonHref }}
https://github.com/TheAlgorithms/Java/pull/7748/files#diff-3dd198ff1bda758d5b9edaf73371aafe69e8c8b0ff2399e0ffaf0d89e86e38d1
https://github.com/TheAlgorithms/Java/pull/7748/files#diff-3dd198ff1bda758d5b9edaf73371aafe69e8c8b0ff2399e0ffaf0d89e86e38d1
Please reload this pagehttps://github.com/TheAlgorithms/Java/pull/7748/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.