Is there a function similar to the Map function in Arduino for Java?
I need to map a range of values to another range of values, so I was wondering if there was something similar to it in Java, I've been searching but I only get the Java's Map function.
The code of map()
from Arduino's library is this:
long map(long x, long in_min, long in_max, long out_min, long out_max)
{
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
This will work in Java just the same - no real magic. But standard Java has nothing predefined like this.