KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am new to Groovy. why this throws exception on runtime: int[] a = [1,2,3,4,5] int lo=0 int hi=4 int x = a[(lo+hi)/2] assert x == 3 while these are ok: int x = a[(int)(lo+hi)/2] and int i = (lo+hi)/2 int x = a[i]
Tags (comma-separated)
Save Edits
Cancel