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

Added math and bit manipulation snippets for java #230

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Mcbencrafter
Copy link
Contributor

@Mcbencrafter Mcbencrafter commented Jan 11, 2025

Description

Added snippets for java including:

  1. Math
  • calculating the greatest common divisor (gcd) and the least common multiple (lcm) of two numbers
  • calculating a checksum of a number
  • calculating the factorial of a number
  • calculating the nth fibonacci number
  • checking if a number is a prime
  1. Bit Manipulation
  • checking if number is a power of two
  • counting the bits in an int

I also capataliezed the titles of date/time snippets because they did look weird and most snippet titles are already capataliezed.

Type of Change

  • ✨ New snippet
  • 🛠 Improvement to an existing snippet
  • 🐞 Bug fix
  • 📖 Documentation update
  • 🔧 Other (please describe):

Checklist

  • I have tested my code and verified it works as expected.
  • My code follows the style and contribution guidelines of this project.
  • Comments are added where necessary for clarity.
  • Documentation has been updated (if applicable).
  • There are no new warnings or errors from my changes.

Related Issues

None

Additional Context

Screenshots (Optional)

Click to view screenshots

Copy link
Collaborator

@Mathys-Gasnier Mathys-Gasnier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little change, but overall great work

@@ -0,0 +1,23 @@
---
title: Bit Counting
description: Counts the bits in an integer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the description could be more descriptive, for example adding that it counts "enabled" bits in an int.

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

Successfully merging this pull request may close these issues.

2 participants