Given an array first of double values, make another array second…