Critical length of nanowires for hydrophobic behavior