{"id":32,"date":"2017-07-16T10:15:22","date_gmt":"2017-07-16T10:15:22","guid":{"rendered":"http:\/\/hackerintent.co.nf\/?p=32"},"modified":"2017-07-16T10:15:22","modified_gmt":"2017-07-16T10:15:22","slug":"virtual-rubiks-cubes-java-3d-arrays","status":"publish","type":"post","link":"https:\/\/takeondevops.com\/?p=32","title":{"rendered":"Virtual Rubik&#8217;s cubes. [Java 3D arrays]"},"content":{"rendered":"<p>Recently a friend of mine (Junior batch) was finding it difficult to understand an assignment that he was given based on 3D arrays in Java. So he asked me to have a look. After looking at the question I knew that it wasn&#8217;t going to be easy. \u00a0But I was able to eventually rig out a solution to tackle this tricky problem.<\/p>\n<p>Basically, in order to understand 3D arrays in Java, one must know what 2D arrays are first. 2D arrays are arrays of arrays. 2D arrays could be visualized as a table with rows and columns. Therefore you would need 2 loops to access an element in a 2D array &#8211; One to iterate through the &#8220;rows&#8221; and the other to iterate through the &#8220;columns&#8221;.<\/p>\n<p>If one could clearly understand 2D arrays then the only additional thing in 3D arrays that they need to know is that 3D arrays are arrays of 2D arrays. It could be visualized as a Rubik&#8217;s cube. (We need to check for a side in a Rubik&#8217;s cube other than the row and the column). In order to access (and\/or manipulate) elements we need another loop (i.e. 3 loops in total).<\/p>\n<p>The tricky part in 3D arrays are visualizing how they work, when it comes to developing solutions to problems. So this assignment was created to test student&#8217;s ability to tackle such situations.<\/p>\n<h3>Give me the link already!<\/h3>\n<p>Here is the link to the solution I came up with (The assignment question is also available as a PDF). https:\/\/github.com\/ihsanizwer\/TableMan. If you know how this could be optimized,or have any questions on this, \u00a0then please do let me know in the comments or by contacting me \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently a friend of mine (Junior batch) was finding it difficult to understand an assignment that he was given based on 3D arrays in Java. So he asked me to have a look. After looking at the question I knew that it wasn&#8217;t going to be easy. \u00a0But I was able to eventually rig out [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-32","post","type-post","status-publish","format-standard","hentry","category-dev"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Virtual Rubik&#039;s cubes. [Java 3D arrays] - Take On Devops<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/takeondevops.com\/?p=32\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Virtual Rubik&#039;s cubes. [Java 3D arrays] - Take On Devops\" \/>\n<meta property=\"og:description\" content=\"Recently a friend of mine (Junior batch) was finding it difficult to understand an assignment that he was given based on 3D arrays in Java. So he asked me to have a look. After looking at the question I knew that it wasn&#8217;t going to be easy. \u00a0But I was able to eventually rig out [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/takeondevops.com\/?p=32\" \/>\n<meta property=\"og:site_name\" content=\"Take On Devops\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-16T10:15:22+00:00\" \/>\n<meta name=\"author\" content=\"ihsan izwer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ihsan izwer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32\"},\"author\":{\"name\":\"ihsan izwer\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/#\\\/schema\\\/person\\\/465f2fb632235eb4079002754cd66aeb\"},\"headline\":\"Virtual Rubik&#8217;s cubes. [Java 3D arrays]\",\"datePublished\":\"2017-07-16T10:15:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32\"},\"wordCount\":292,\"commentCount\":0,\"articleSection\":[\"Dev\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/takeondevops.com\\\/?p=32#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32\",\"url\":\"https:\\\/\\\/takeondevops.com\\\/?p=32\",\"name\":\"Virtual Rubik's cubes. [Java 3D arrays] - Take On Devops\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/takeondevops.com\\\/#website\"},\"datePublished\":\"2017-07-16T10:15:22+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/takeondevops.com\\\/#\\\/schema\\\/person\\\/465f2fb632235eb4079002754cd66aeb\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/takeondevops.com\\\/?p=32\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/?p=32#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/takeondevops.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Virtual Rubik&#8217;s cubes. [Java 3D arrays]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/#website\",\"url\":\"https:\\\/\\\/takeondevops.com\\\/\",\"name\":\"Take On Devops\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/takeondevops.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/takeondevops.com\\\/#\\\/schema\\\/person\\\/465f2fb632235eb4079002754cd66aeb\",\"name\":\"ihsan izwer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g\",\"caption\":\"ihsan izwer\"},\"url\":\"https:\\\/\\\/takeondevops.com\\\/?author=3\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Virtual Rubik's cubes. [Java 3D arrays] - Take On Devops","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/takeondevops.com\/?p=32","og_locale":"en_US","og_type":"article","og_title":"Virtual Rubik's cubes. [Java 3D arrays] - Take On Devops","og_description":"Recently a friend of mine (Junior batch) was finding it difficult to understand an assignment that he was given based on 3D arrays in Java. So he asked me to have a look. After looking at the question I knew that it wasn&#8217;t going to be easy. \u00a0But I was able to eventually rig out [&hellip;]","og_url":"https:\/\/takeondevops.com\/?p=32","og_site_name":"Take On Devops","article_published_time":"2017-07-16T10:15:22+00:00","author":"ihsan izwer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ihsan izwer","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/takeondevops.com\/?p=32#article","isPartOf":{"@id":"https:\/\/takeondevops.com\/?p=32"},"author":{"name":"ihsan izwer","@id":"https:\/\/takeondevops.com\/#\/schema\/person\/465f2fb632235eb4079002754cd66aeb"},"headline":"Virtual Rubik&#8217;s cubes. [Java 3D arrays]","datePublished":"2017-07-16T10:15:22+00:00","mainEntityOfPage":{"@id":"https:\/\/takeondevops.com\/?p=32"},"wordCount":292,"commentCount":0,"articleSection":["Dev"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/takeondevops.com\/?p=32#respond"]}]},{"@type":"WebPage","@id":"https:\/\/takeondevops.com\/?p=32","url":"https:\/\/takeondevops.com\/?p=32","name":"Virtual Rubik's cubes. [Java 3D arrays] - Take On Devops","isPartOf":{"@id":"https:\/\/takeondevops.com\/#website"},"datePublished":"2017-07-16T10:15:22+00:00","author":{"@id":"https:\/\/takeondevops.com\/#\/schema\/person\/465f2fb632235eb4079002754cd66aeb"},"breadcrumb":{"@id":"https:\/\/takeondevops.com\/?p=32#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/takeondevops.com\/?p=32"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/takeondevops.com\/?p=32#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/takeondevops.com\/"},{"@type":"ListItem","position":2,"name":"Virtual Rubik&#8217;s cubes. [Java 3D arrays]"}]},{"@type":"WebSite","@id":"https:\/\/takeondevops.com\/#website","url":"https:\/\/takeondevops.com\/","name":"Take On Devops","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/takeondevops.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/takeondevops.com\/#\/schema\/person\/465f2fb632235eb4079002754cd66aeb","name":"ihsan izwer","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c82c3d13c92d77259746074978cb7d498778b44914dea60ad0367dec237c349f?s=96&d=mm&r=g","caption":"ihsan izwer"},"url":"https:\/\/takeondevops.com\/?author=3"}]}},"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/takeondevops.com\/index.php?rest_route=\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/takeondevops.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/takeondevops.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/takeondevops.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/takeondevops.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=32"}],"version-history":[{"count":0,"href":"https:\/\/takeondevops.com\/index.php?rest_route=\/wp\/v2\/posts\/32\/revisions"}],"wp:attachment":[{"href":"https:\/\/takeondevops.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/takeondevops.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/takeondevops.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}