JSFiddle - React, Tailwind, and code Playground

JavaScript

int adc = Integer.parseInt(value);
float vol = (float) (adc * 3.3 / 1024.0);
// based on ML8511 intensity graph
float uv = (float) ((vol - 0.99) * (15 - 0) / (2.8 - 0.99) + 0);

if (uv < 0) uv = 0;
String out = String.format("%.02f", uv);
changeText(tvValue, out , 0);

if (uv < 3) changeText(tvLabel, "Low", Color.GREEN);
else if (uv < 6) changeText(tvLabel, "Moderate", Color.YELLOW);
else if (uv < 8) changeText(tvLabel, "High", Color.rgb(0xFF, 0x66, 0x00));
else if (uv < 11) changeText(tvLabel, "Very High", Color.RED);
else changeText(tvLabel, "Extreme", Color.rgb(0x96, 0x00, 0xFF));