Flowchart (ISO 5807)
Source code
Java
class Power {
static long fastPow(long base, int exp) {
long result = 1;
while (exp > 0) {
if (exp % 2 == 1) {
result = result * base;
}
base = base * base;
exp = exp / 2;
}
return result;
}
}The editor opens with this code — change it and the chart redraws.
- Language
- Java
- Constructs
- binary exponentiation
- Topic
- Algorithms
- Formats
- Word, Visio, draw.io, PDF, SVG