<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: integervis</title>
    <description>The latest articles on DEV Community by integervis (@integervis).</description>
    <link>https://dev.to/integervis</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F561740%2F486bda9c-729d-4eee-9622-eb7733d7c674.jpeg</url>
      <title>DEV Community: integervis</title>
      <link>https://dev.to/integervis</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/integervis"/>
    <language>en</language>
    <item>
      <title>Palindrome with % and / [Java]</title>
      <dc:creator>integervis</dc:creator>
      <pubDate>Mon, 28 Mar 2022 17:33:22 +0000</pubDate>
      <link>https://dev.to/integervis/palindrome-with-and-java-136h</link>
      <guid>https://dev.to/integervis/palindrome-with-and-java-136h</guid>
      <description>&lt;p&gt;You can use different ways to find out if a number is palindrome using string conversion. I want to explore here an algorithm with a while loop in Java using modulo operator and integer division.&lt;/p&gt;

&lt;p&gt;A number is palindrome if it is the same when reading it from left to right and right to left. As an example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;1331 is a palindrome;&lt;/li&gt;
&lt;li&gt;1234 is not.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore we need to find the reversed number and check if it’s equal to the original one.&lt;/p&gt;

&lt;p&gt;A while loop is perfect for this scenario. We are going to take the original number and deconstruct it in its original digits. We will use these to rebuild the reversed numbner.&lt;/p&gt;

&lt;p&gt;Before going to the solution there are a couple of properties we need to mention first:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modulo operator&lt;/strong&gt; returns the remainder of a division hence, if we have a number %10 we will have the last digit of that number. No rounding will happen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1123 MOD 10 = 3
1124 MOD 10 = 4
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the main tool we will use to grab the last digits of any integer number.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integer division&lt;/strong&gt; will discard the remainder. So any integer divided by 10 will simply provide the remaining number and remove the last digit.&lt;/p&gt;

&lt;p&gt;This step is important to provide a different number so that in the next iteration the remainder will be correct.&lt;/p&gt;

&lt;p&gt;Below the solution including all of the logics we mentioned above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Palindrome&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

        &lt;span class="c1"&gt;// hard-coding my numbers for ease of use&lt;/span&gt;
        &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1771&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
        &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;num&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;reversedNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

            &lt;span class="c1"&gt;// MOD division to get the last digit&lt;/span&gt;
            &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;lastDigit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

            &lt;span class="c1"&gt;// reversed number built by adding the last digit &lt;/span&gt;
            &lt;span class="c1"&gt;// to the previous last digit multiplied by 10. &lt;/span&gt;
            &lt;span class="c1"&gt;// We are shifting the numbers.&lt;/span&gt;
            &lt;span class="n"&gt;reversedNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;reversedNumber&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;lastDigit&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

            &lt;span class="c1"&gt;// integer division that will equal to 0 &lt;/span&gt;
            &lt;span class="c1"&gt;// if the number is &amp;lt; 10 and &lt;/span&gt;
            &lt;span class="c1"&gt;// consequently stopping the while loop.&lt;/span&gt;
            &lt;span class="n"&gt;temp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;temp&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt; 
        &lt;span class="o"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;num&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;reversedNumber&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"It is a palindrome"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"It is not a palindrome"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am fascinated by the logics within the loop but let me know what you think of this approach.&lt;/p&gt;

</description>
      <category>java</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>I found a job!</title>
      <dc:creator>integervis</dc:creator>
      <pubDate>Tue, 22 Feb 2022 18:56:30 +0000</pubDate>
      <link>https://dev.to/integervis/i-found-a-job-20h3</link>
      <guid>https://dev.to/integervis/i-found-a-job-20h3</guid>
      <description>&lt;p&gt;I am so happy. It took 10 months to complete this career change from building engineering and architecture to coding.&lt;/p&gt;

&lt;p&gt;The full stack web dev bootcamp was a great experience. So great that I resigned from my previous job (not tech related) and decided to pursue the dream full time.&lt;/p&gt;

&lt;p&gt;After completing the bootcamp I started working there as a teaching assistant. This was a great experience to refresh and solidfy the whole experience. You learn OOP only when you try to explain it to someone who is not familiar with it.&lt;/p&gt;

&lt;p&gt;I am now learning Java in this new company and loooking forward to post my findings.&lt;/p&gt;

&lt;p&gt;Stay tuned!&lt;/p&gt;

</description>
      <category>java</category>
      <category>career</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Welcome to my dev journal</title>
      <dc:creator>integervis</dc:creator>
      <pubDate>Fri, 27 Aug 2021 21:04:18 +0000</pubDate>
      <link>https://dev.to/integervis/welcome-to-my-dev-journal-5ea7</link>
      <guid>https://dev.to/integervis/welcome-to-my-dev-journal-5ea7</guid>
      <description>&lt;h1&gt;
  
  
  &lt;em&gt;You know if your code works or if it doesn't. And this is powerful.&lt;/em&gt;
&lt;/h1&gt;

&lt;p&gt;I moved in London three years ago, 2018, but it was only during the lockdown that I really started to question myself about what I really want to do in my life. I guess it was a great time of reflection for everyone. Basically I was not happy with my choices and the lockdown pushed everything to the limit.&lt;/p&gt;

&lt;p&gt;This general feeling of unease lead to a very interesting conversation with my dear friend F. to whom I mentioned my life-long passion for coding that, for some unknown reasons, I never really followed.&lt;/p&gt;

&lt;p&gt;In middle school, the girl I had a massive crush on asked me to burn her a cd with some songs. Instead of just writing a cd containing the mp3s I created a menu with the 'autorun.inf' automatically showing a window with a soundtrack and button to play the songs.(She wasnt impressed though....)&lt;/p&gt;

&lt;p&gt;Later on I explored Turbo Pascal, Visual Basic, Fortran 77 and bits of web development (HTML, CSS, JS) on my own and thanks to my high school / uni.&lt;/p&gt;

&lt;p&gt;I never asked myself the big question: why not trying to properly learn coding? (I was studyin Civil Engineering and Architecture).&lt;/p&gt;

&lt;p&gt;It was F. who, after that chat, realised how much I would enjoy it and kept pushing me everyday for a couple of months until I paid the subscription to LeWagon for the part time bootcamp.&lt;/p&gt;

&lt;p&gt;Now, at only one month left to the bootcamp and after five quite intense months I realised that coding makes me happy. It delivers so much: abstract problem solving is extremely rewarding because of the validation coming mainly from yourself.&lt;/p&gt;

&lt;p&gt;After finishing the lectures we started coding our first airbnb clone. Every single day of those two weeks was so exciting. I would start coding after dinner and suddenly it was 2am and I wasn't even tired. &lt;/p&gt;

&lt;p&gt;This must mean something, right?&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
