Thanks for @ohazyi and @awice pointing it out. I've updated my code below and it passes all test cases now.

```
public int numSubarrayProductLessThanK(int[] nums, int k) {
if (k < 2) {
return 0;
}
int result = 0;
int product = 1;
for (int i = 0, right = 0; right < nums.length; right++) {
product *= nums[right];
while (i < nums.length && product >= k) {
product /= nums[i++];
}
result += right - i + 1;
}
return result;
}
```