tag:blogger.com,1999:blog-5638372.post6288288321910202146..comments2023-10-10T05:22:56.347-05:00Comments on binkley's BLOG: Java data validation trick with bit-twiddlingBrian Oxleyhttp://www.blogger.com/profile/06617364377560752378noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-5638372.post-49036102638234032092007-10-19T10:47:00.000-05:002007-10-19T10:47:00.000-05:00And doesn't need modifications for greater amount ...And doesn't need modifications for greater amount of fields eather.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5638372.post-83228775625872968912007-10-19T10:45:00.000-05:002007-10-19T10:45:00.000-05:00This should do same without bitfields and it does ...This should do same without bitfields and it does not fail with more than eight fields:<BR/><BR/>private static boolean valid2(String... fields) {<BR/> boolean nullFound = false;<BR/> for (String field : fields) {<BR/> if (field == null) {<BR/> nullFound = true;<BR/> }<BR/> else if (nullFound) {<BR/> return false;<BR/> }<BR/> }<BR/> return true;<BR/>}Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5638372.post-51232312967935099342007-10-14T23:01:00.000-05:002007-10-14T23:01:00.000-05:00I looked into BitSet but it does not provide what ...I looked into BitSet but it does not provide what I need to use the powers-of-two trick.Brian Oxleyhttps://www.blogger.com/profile/06617364377560752378noreply@blogger.comtag:blogger.com,1999:blog-5638372.post-46155713813010628372007-10-11T11:34:00.000-05:002007-10-11T11:34:00.000-05:00Not sure, but use of BitSet might make this code c...Not sure, but use of BitSet might make this code clearer.Alex Millerhttps://www.blogger.com/profile/01929662536395624733noreply@blogger.com