v.io/x/ref/lib/vdl/codegen/java: accessor for primitive arrays

Change-Id: I0328849213030e2d2bfd194f2af216a6599b66fa
diff --git a/lib/vdl/codegen/java/file_array.go b/lib/vdl/codegen/java/file_array.go
index 633e8a1..44f710d 100644
--- a/lib/vdl/codegen/java/file_array.go
+++ b/lib/vdl/codegen/java/file_array.go
@@ -56,6 +56,17 @@
         super(VDL_TYPE, convert(arr));
     }
 
+	/**
+	 * Converts the array into its primitive (array) type.
+	 */
+	public {{ .ElemPrimitiveType }}[] toPrimitiveArray() {
+		{{ .ElemPrimitiveType }}[] ret = new {{ .ElemPrimitiveType }}[size()];
+		for (int i = 0; i < size(); ++i) {
+			ret[i] = get(i);
+		}
+		return ret;
+	}
+
     private static {{ .ElemType }}[] convert({{ .ElemPrimitiveType }}[] arr) {
         {{ .ElemType }}[] ret = new {{ .ElemType }}[arr.length];
         for (int i = 0; i < arr.length; ++i) {