Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1
Add two new blogposts#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
81 changes: 81 additions & 0 deletions_posts/2020-12-23-create-uuid-in-java.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| layout: post | ||
| title: "How To Create UUID in Java?" | ||
| author: gaurav | ||
| image: assets/images/2020-12-23/create-uuid-in-java.png | ||
| categories: [ Java, Core Java, String] | ||
| description: In this article you will see, how to create UUID in Java. | ||
| --- | ||
| ## Introduction | ||
| UUID, a universally unique identifier is a 128-bit number used to identify information in computer systems. | ||
| UUID is made of hex digits along with 4 hyphen ("-") symbols. The length of a UUID is 36 characters. | ||
| There are 5 types of UUID but mostly version 4 i.e. Randomly Generated UUID is used. | ||
| We are going to create the version 4 UUID here. | ||
| ### Example UUID | ||
| df6fdea1-10c3-474c-ae62-e63def80de0b | ||
| ## How to create UUID in Java? | ||
| Creating a Randomly Generated UUID (version 4) is really easy in Java. | ||
| UUID Class is present in `java.util` package. And it has the static method `randomUUID()` which returns the randomly generated UUID. | ||
| The example is given below. | ||
| ```java | ||
| import java.util.UUID; | ||
| /** | ||
| * A Java program to create a Randomly Generated UUID i.e. Version 4 UUID | ||
| * @author Gaurav Kukade at coderolls.com | ||
| * | ||
| */ | ||
| public class CreateUUID { | ||
| public static void main(String[] args) { | ||
| // creating random uuid i.e. version 4 UUID | ||
| UUID uuid = UUID.randomUUID(); | ||
| System.out.println("Printing the randomly generated UUID value......\n"); | ||
| System.out.println("uuid: "+uuid); | ||
| } | ||
| } | ||
| ``` | ||
| Output | ||
| ```java | ||
| Printing the randomly generated UUID value...... | ||
| uuid: e3aed661-ccc2-42fd-ad69-734fee350cd2 | ||
| ``` | ||
| Get the [above code as GitHub Gist](https://gist.github.com/gauravkukade/395f314c549969bd300d72c7e032dbcb). | ||
| -------- | ||
| You can visit my [YouTube channel 'coderolls'](https://www.youtube.com/channel/UCl31HHUdQbSHOQfc9L-wo3w?view_as=subscriber?sub_confirmation=1) to find more video tutorials. | ||
| If you found this article worth, support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade) | ||
| #### Related Articles | ||
| - [Learn About Java String Pool And intern() Method](https://coderolls.com/java-string-pool-and-intern-method/) | ||
| - [How Do I Compare Strings In Java](https://coderolls.com/compare-strings-in-java/) | ||
| - [How To Reverse A String In Java (5 ways)](https://coderolls.com/reverse-a-string-in-java/) | ||
| - [Compare Two Strings Lexicographically In Java](https://coderolls.com/compare-two-strings-lexicographically-in-java/) | ||
| - [Difference Between StringBuffer and StringBuilder class](https://coderolls.com/difference-between-stringbuffer-and-stringbuilder/) | ||
| - [8 Basic GIT Commands Every Newbie Developer Must Know](https://coderolls.com/basic-git-commands/) |
65 changes: 65 additions & 0 deletions_posts/2020-12-25-convert-stringbuilder-to-string-in-java.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| --- | ||
| layout: post | ||
| title: "How To Convert StringBuilder To String In Java?" | ||
| author: gaurav | ||
| image: assets/images/2020-12-25/convert-stringbuilder-to-string-in-java.png | ||
| categories: [ Java, Core Java, String] | ||
| description: In this article you will see, how to convert a StringBuilder to String in Java. | ||
| featured: false | ||
| --- | ||
| ## Introduction | ||
| Java `StringBuilder` is non-synchronized update of the `StringBuffer` class. | ||
| Sometimes there is need to convert the `StringBuilder` object to the `String`. We can do it easily by smply invoking the `toString()` method. | ||
| Let see the example program below. | ||
| ## Java Program to convert `StringBuilder` to `String` | ||
| ```java | ||
| /** | ||
| * A Java program to convert StringBuilder to String | ||
| * @author Gaurav Kukade at cderlls.com | ||
| * | ||
| */ | ||
| public class StringBuilderToString { | ||
| public static void main(String[] args) { | ||
| StringBuilder stringBuilder = new StringBuilder("Hello "); | ||
| stringBuilder.append("Gaurav ") | ||
| .append("Kukade!"); | ||
| System.out.println("Printing strinBuilder as String: \n"); | ||
| System.out.println(stringBuilder.toString()); | ||
| } | ||
| } | ||
| ``` | ||
| Output: | ||
| ```java | ||
| Printing strinBuilder as String: | ||
| Hello Gaurav Kukade! | ||
| ``` | ||
| Get the [above code as GitHub Gist](https://gist.github.com/gauravkukade/00bd416bcb2ca1c72dbcd600d48e2f78). | ||
| --------- | ||
| You can visit my [YouTube channel 'coderolls'](https://www.youtube.com/channel/UCl31HHUdQbSHOQfc9L-wo3w?view_as=subscriber?sub_confirmation=1) to find more video tutorials. | ||
| If you found this article worth, support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade) | ||
| #### Related Articles | ||
| - [Learn About Java String Pool And intern() Method](https://coderolls.com/java-string-pool-and-intern-method/) | ||
| - [How Do I Compare Strings In Java](https://coderolls.com/compare-strings-in-java/) | ||
| - [How To Reverse A String In Java (5 ways)](https://coderolls.com/reverse-a-string-in-java/) | ||
| - [Compare Two Strings Lexicographically In Java](https://coderolls.com/compare-two-strings-lexicographically-in-java/) | ||
| - [Difference Between StringBuffer and StringBuilder class](https://coderolls.com/difference-between-stringbuffer-and-stringbuilder/) | ||
| - [8 Basic GIT Commands Every Newbie Developer Must Know](https://coder |
Binary file addedassets/images/2020-12-23/create-uuid-in-java.png
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file addedassets/images/2020-12-25/convert-stringbuilder-to-string-in-java.png
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.