Given
scala> val a = (1 to 9).toArray a: Array[Int] = Array(1, 2, 3, 4, 5, 6, 7, 8, 9)
would like to group elements in a in th
a
If you want to get groups by 3 elements you could use method grouped:
grouped
a.grouped(3).toArray // Array(Array(1, 2, 3), Array(4, 5, 6), Array(7, 8, 9))