New Zealand voted to retain its national flag, which includes the Union Jack of its former colonial ruler, after a 16-month exercise that cost taxpayers NZ$26mn ($17.44mn).