{"id":24053061,"url":"https://github.com/avidhanr/codinginjava","last_synced_at":"2025-02-26T10:21:53.241Z","repository":{"id":270497005,"uuid":"910554750","full_name":"AVidhanR/CodingInJava","owner":"AVidhanR","description":"Nothing much here, Just basic Java Coding that I'm wanting to learn from years!","archived":false,"fork":false,"pushed_at":"2025-01-30T17:33:33.000Z","size":115,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-30T18:31:52.829Z","etag":null,"topics":["dsa","git-cli","java"],"latest_commit_sha":null,"homepage":"https://avidhanr.github.io/CodingInJava/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AVidhanR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-31T16:06:12.000Z","updated_at":"2025-01-30T17:33:36.000Z","dependencies_parsed_at":"2025-01-15T17:43:20.804Z","dependency_job_id":"6d39b2af-169d-4b9b-a821-6dad02bcc559","html_url":"https://github.com/AVidhanR/CodingInJava","commit_stats":null,"previous_names":["avidhanr/codinginjava"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVidhanR%2FCodingInJava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVidhanR%2FCodingInJava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVidhanR%2FCodingInJava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVidhanR%2FCodingInJava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AVidhanR","download_url":"https://codeload.github.com/AVidhanR/CodingInJava/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240832455,"owners_count":19864936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dsa","git-cli","java"],"created_at":"2025-01-09T02:22:30.846Z","updated_at":"2025-02-26T10:21:53.170Z","avatar_url":"https://github.com/AVidhanR.png","language":"Java","readme":"# Java In Practice\nFinally, I can put my time into learning `Java` for real.\n\n- Access the root of the codebase from [`here`](src/main/java/dev/itsvidhanreddy/) \n- Learning the basic program problems from [`gfg/basic-programming-problems`](https://www.geeksforgeeks.org/basic-programming-problems/) \n- Feel free to visit my portfolio from [`itvidhanreddy.vercel.app`](https://itsvidhanreddy.vercel.app) \n- Follow me on LinkedIn: [`in/AVidhanR`](https://linkedin.com/in/AVidhanR) \n\n# The Below codes, sure are handy\n```java\n// if return type is List\u003cInteger\u003e\nreturn Arrays.asList(a, b);\n```\n\nI'm lazy, so I did this\n```java\nimport java.util.Arrays;\n// gives the sum!\nint s = Arrays.stream(array).sum();\n```\n\nIn 2D matrix, the below code is handy\n```java\n// for traversing and other element level operations\nfor (int[] rows : matrix) {\n    for (int ele : rows) {\n        sum += ele;\n    }\n}\n```\n\nWhile using String's as char's the below code is handy,\n```java\nfor (char c : v.toCharArray()) {\n    // something here...    \n}\n```\n## Find lengths\nTo find the length of an array,\n```java\nint[] arr = new int[] {10, 11, 12, 13};\nint lengthOfArray = arr.length;\n```\n\nTo find the length of a number,\n```java\nint n = 1234;\nint l = String.valueOf(n).length(); // 4\n```\n\n## Typical `git-cli`\ngit initial process\n```bash\ngit init -b main\n# to check the logs\ngit log\n```\nThe after-math,\n```bash\ngit add . \u0026\u0026 git commit -m \"\" \u0026\u0026 git push\n# skip staging or adding and directly commit\ngit commit -a -m \"message\"\n# changes made?\ngit diff\n# rm the env from git if staged\ngit rm --cached env\n```\n\nFetch the latest changes from the remote repository,\n```bash\ngit fetch origin\ngit pull origin main\n```\n\nCheck the below code,\n```java\n// I ain't understood a thing in the below code\nfor (int t = n; t \u003e 0; t /= 2) {\n    b = (t % 2) + b;\n}\n\n// so I used the below abstract method\nreturn Integer.toBinaryString(num);\n```\n\nWell, if you want to return `int` values as an array of `int`: the below code is handy,\n```java\nreturn new int[] {1, 2, 3}; // or {a, b, c} if they have data in it.\n```\n\n## The `find` command\n- The find command in Bash is a powerful tool for searching and locating files and directories based on various conditions. Here's a comprehensive overview:\nBasic Syntax,\n```bash\nfind [options] [path] [expression]\n```\n### Options\n- -name: Search by file name\n- -iname: Search by file name (case-insensitive)\n- -type: Search by file type (e.g., f for files, d for directories)\n- -size: Search by file size\n- -mtime: Search by modification time\n- -atime: Search by access time\n- -ctime: Search by creation time\n- -exec: Execute a command on the found files\n- -ok: Similar to -exec, but prompts for confirmation before executing\n### Expressions\n- -a: Logical AND operator\n- -o: Logical OR operator\n- !: Logical NOT operator\n### Examples\n- Find files by name: find . -name \"example.txt\"\n- Find files by type: find . -type f -name \"*.txt\"\n- Find files larger than 1MB: find . -size +1M\n- Find files modified within the last 24 hours: find . -mtime -1\n- Delete files older than 30 days: find . -type f -mtime +30 -delete\n- Execute a command on found files: find . -type f -name \"*.txt\" -exec cat {} \\;\n### Tips and Tricks\n- Use . to search in the current directory and its subdirectories.\n- Use ~ to search in the user's home directory.\n- Use ! to negate a condition (e.g., ! -name \"*.txt\").\n- Use parentheses to group conditions (e.g., ( -name \"*.txt\" -o -name \"*.pdf\" )).\n- Use -print to print the found files (default behavior).\n- Use -exec with {} \\; to execute a command on each found file.\n\n## `bash` is a lifesaver \n Bash Script is a lifesaver for lazy people like myself,\n ```bash\n bash ./StartUpProcess.sh\n # removes all the existing .class files and fetches the data from github on latest changes\n ```\nThis YouTube vidoe for learning full stack `jave` is good: [`link`](https://youtu.be/4XTsAAHW_Tc?si=fTRuJu1kjPDS6KNX)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favidhanr%2Fcodinginjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favidhanr%2Fcodinginjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favidhanr%2Fcodinginjava/lists"}