Skip to content

A java class with some useful methods for dealing with numbers, and converting them to binary.

License

Notifications You must be signed in to change notification settings

sasbury/numberutils_java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

numberutils_java

I have, on a few occasions, needed some utilities to convert numbers to binary, so I created a class that will do this for the various numbers in Java.

There are also a number of methods to take a number and encoded it onto an interval using steps. This allows you to compact a number into a small binary representation with some loss flexibility and/or accuracy.

I also wrote a really simple method that returns the closest prime less than or equal to any number up to 11,000. The goal was for supporting prime array sizes in hash tables. Finally there is a method to convert the sum of all numbers up to and including the number you pass in. This is a nice example of using an algorithm instead of brute force.

The test file relies on JUnit which is not included.

About

A java class with some useful methods for dealing with numbers, and converting them to binary.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages