How can I flatten the 2 dimensions array int originalArray[][] to 1 dimension array?
int a [] = {1,2,6,7,2};
int b [] = {2,44,55,2};
int c [] = {2,44,511,33};
int originalArray [][] = new int[][]{a,b,c};
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A simple for loop will do, it is not difficult, but will depend on the order in which you want to copy the values. For instance (based on the fact that in your example the arrays all have the same length):
or (different order, a, b, c can be of different lengths):