Using methods to solve problems related to Arrays