{"id":2533,"date":"2019-10-07T10:00:23","date_gmt":"2019-10-07T14:00:23","guid":{"rendered":"http:\/\/www.mymiller.name\/wordpress\/?p=2533"},"modified":"2019-03-31T05:21:21","modified_gmt":"2019-03-31T09:21:21","slug":"count-the-number-of-carry-operations","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/challenge\/count-the-number-of-carry-operations\/","title":{"rendered":"Count the number of Carry Operations"},"content":{"rendered":"\n<p>This is a simple challenge I&#8217;ve seen recently.  I&#8217;ve looked around the web and found that I didn&#8217;t care for the Java implementations, so put my mind to work and came up with a new solution.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int countCarryOperations(int a, int b) {\n        int multiplier = 10;\n        int count = 0;\n        int modA = 0;\n        int modB = 0;\n        int carryOver =0;\n\n        do {\n            int Ax = ((a % multiplier ) - modA) \/ (multiplier \/10);\n            int Bx = ((b % multiplier ) - modB) \/ (multiplier \/10);\n\n            int x = Ax+Bx + carryOver;\n            if(x >= 10) {\n                count++;\n                carryOver = 1;\n            } else {\n                carryOver = 0;\n            }\n            modA = a % multiplier;\n            modB = b % multiplier;\n\n            if(modA == a &amp;&amp; modB == b) {\n                break;\n            }\n\n            multiplier *= 10;\n        }while(true);\n        return count;\n    }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is a simple challenge I&#8217;ve seen recently. I&#8217;ve looked around the web and found that I didn&#8217;t care for the Java implementations, so put my mind to work and came up with a new solution.<\/p>\n","protected":false},"author":1,"featured_media":2534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[273],"tags":[69],"series":[],"class_list":["post-2533","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-challenge","tag-java-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2019\/03\/vintage-649760_640.jpg?fit=640%2C424&ssl=1","jetpack-related-posts":[{"id":2831,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/minecraft-functions-meets-java\/","url_meta":{"origin":2533,"position":0},"title":"Minecraft Functions meets Java","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"My son has gotten into Minecraft and Star Wars. He wanted the two of us to build the Death Star in Minecraft. That is not a small undertaking. I got thinking about it, and came up with the idea to use Java to create function files that would create the\u2026","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/07\/battle_station.png?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/07\/battle_station.png?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/07\/battle_station.png?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3380,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/synchronous-to-asynchronous\/","url_meta":{"origin":2533,"position":1},"title":"Synchronous to Asynchronous","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Converting a synchronous method to an asynchronous one in Java involves modifying the code to allow other tasks to execute while it is waiting for input\/output operations to complete. Here's an example of how to convert a synchronous method to an asynchronous one in Java: Let's say we have a\u2026","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/multitasking-ga6749a2b2_640.jpg?fit=640%2C394&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/multitasking-ga6749a2b2_640.jpg?fit=640%2C394&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/multitasking-ga6749a2b2_640.jpg?fit=640%2C394&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1901,"url":"https:\/\/www.mymiller.name\/wordpress\/java_http\/http-server-jar\/","url_meta":{"origin":2533,"position":2},"title":"HTTP Server in your Jar","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"I recently had the need to be able to access a couple of files from a number of computers and didn't want to setup network shares and things. \u00a0These were a simple text files, that I was logging information into. However I was going to be moving around a number\u2026","rel":"","context":"In &quot;Java HTTP&quot;","block_context":{"text":"Java HTTP","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_http\/"},"img":{"alt_text":"filters","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/http-875180_640.jpg?fit=640%2C452&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/http-875180_640.jpg?fit=640%2C452&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/http-875180_640.jpg?fit=640%2C452&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3600,"url":"https:\/\/www.mymiller.name\/wordpress\/java_new_features\/record-patterns-in-java-21-simplifying-data-extraction\/","url_meta":{"origin":2533,"position":3},"title":"Record Patterns in Java 21: Simplifying Data Extraction","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Java 21 introduces record patterns, a powerful addition to the pattern matching arsenal. This feature streamlines the extraction of components from record classes, making code more concise and readable. What are Record Patterns? Record patterns leverage the structure of record classes to deconstruct them into their constituent parts. By specifying\u2026","rel":"","context":"In &quot;Java New Features&quot;","block_context":{"text":"Java New Features","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_new_features\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/collector-3930337_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/collector-3930337_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/collector-3930337_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/collector-3930337_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/07\/collector-3930337_1280-jpg.avif 3x"},"classes":[]},{"id":1936,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/advancedstring-java-lang-string-steroids\/","url_meta":{"origin":2533,"position":4},"title":"AdvancedString &#8211; java.lang.String on steroids!","author":"Jeffery Miller","date":"November 24, 2025","format":false,"excerpt":"Every need an additional method on the String Class? \u00a0Well I have and it would have made life much easier. \u00a0Unfortunately you can't subclass String as it is Final. \u00a0So what are you to do? \u00a0Well you wrap the String class. \u00a0I have created AdvancedString, which contains additional functionality and\u2026","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"AdvancedString","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/rope-1379561_640.jpg?fit=640%2C425&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/rope-1379561_640.jpg?fit=640%2C425&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/09\/rope-1379561_640.jpg?fit=640%2C425&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":1846,"url":"https:\/\/www.mymiller.name\/wordpress\/challenge\/dividing-game\/","url_meta":{"origin":2533,"position":5},"title":"Dividing Game Interview Coding Sample","author":"Jeffery Miller","date":"August 29, 2016","format":false,"excerpt":"I was recently given the challenge to write an solution for the Dividing Game. \u00a0The objective Player 1 and Player 2 each choose a number. \u00a0The solution should output the number of common divisor's they share in common between the selected numbers. This logic is rather simple, create a list\u2026","rel":"","context":"In &quot;Challenge&quot;","block_context":{"text":"Challenge","link":"https:\/\/www.mymiller.name\/wordpress\/category\/challenge\/"},"img":{"alt_text":"dividing game","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/08\/calculator-1330104_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/08\/calculator-1330104_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2016\/08\/calculator-1330104_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=2533"}],"version-history":[{"count":1,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2533\/revisions"}],"predecessor-version":[{"id":2535,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2533\/revisions\/2535"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/2534"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=2533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=2533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=2533"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=2533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}