Characterization and optimization of silicon nanowires for biosensing and photovoltaic applications