{"action":"created","comment":{"url":"https://api.github.com/repos/thoughtbot/til/pulls/comments/23806334","id":23806334,"diff_hunk":"@@ -0,0 +1,36 @@\n+# NumberFormatting \n+\n+## Assignment\n+Format a number for a specific locale. For example, the number 12345.123 should be formatted as `12,345.12` in the USA locale, but `12.345,12` in the German locale.\n+\n+## Solution\n+```java\n+DecimalFormat currencyFormatter = (DecimalFormat) NumberFormat.getInstance(Locale.getDefault());\n+\n+currencyFormatter.setMaximumFractionDigits(2);\n+currencyFormatter.setMinimumFractionDigits(2);\n+\n+System.out.println(currencyFormatter.format(123456.12));\n+```\n+\n+Depending on your default Locale the currencyFormatter will format the number in the right way for you.\n+\n+##### If you have a locale like `Locale.US` it will output:\n+```java\n+-12,345.12","path":"java/number-formatting.md","position":20,"original_position":20,"commit_id":"3345c124100e3ee2d61941ceb2567f63f75d2e02","original_commit_id":"3345c124100e3ee2d61941ceb2567f63f75d2e02","user":{"login":"thorncp","id":72176,"avatar_url":"https://avatars.githubusercontent.com/u/72176?v=3","gravatar_id":"","url":"https://api.github.com/users/thorncp","html_url":"https://github.com/thorncp","followers_url":"https://api.github.com/users/thorncp/followers","following_url":"https://api.github.com/users/thorncp/following{/other_user}","gists_url":"https://api.github.com/users/thorncp/gists{/gist_id}","starred_url":"https://api.github.com/users/thorncp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thorncp/subscriptions","organizations_url":"https://api.github.com/users/thorncp/orgs","repos_url":"https://api.github.com/users/thorncp/repos","events_url":"https://api.github.com/users/thorncp/events{/privacy}","received_events_url":"https://api.github.com/users/thorncp/received_events","type":"User","site_admin":false},"body":"Another nitpick :grin:, the outputs here are negative, but the code example is not.","created_at":"2015-01-29T21:56:34Z","updated_at":"2015-01-29T21:56:34Z","html_url":"https://github.com/thoughtbot/til/pull/36#discussion_r23806334","pull_request_url":"https://api.github.com/repos/thoughtbot/til/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/comments/23806334"},"html":{"href":"https://github.com/thoughtbot/til/pull/36#discussion_r23806334"},"pull_request":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/thoughtbot/til/pulls/36","id":28129906,"html_url":"https://github.com/thoughtbot/til/pull/36","diff_url":"https://github.com/thoughtbot/til/pull/36.diff","patch_url":"https://github.com/thoughtbot/til/pull/36.patch","issue_url":"https://api.github.com/repos/thoughtbot/til/issues/36","number":36,"state":"open","locked":false,"title":"TIL: Java Number Format (+ Highlighting fix)","user":{"login":"DominikAngerer","id":7952803,"avatar_url":"https://avatars.githubusercontent.com/u/7952803?v=3","gravatar_id":"","url":"https://api.github.com/users/DominikAngerer","html_url":"https://github.com/DominikAngerer","followers_url":"https://api.github.com/users/DominikAngerer/followers","following_url":"https://api.github.com/users/DominikAngerer/following{/other_user}","gists_url":"https://api.github.com/users/DominikAngerer/gists{/gist_id}","starred_url":"https://api.github.com/users/DominikAngerer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominikAngerer/subscriptions","organizations_url":"https://api.github.com/users/DominikAngerer/orgs","repos_url":"https://api.github.com/users/DominikAngerer/repos","events_url":"https://api.github.com/users/DominikAngerer/events{/privacy}","received_events_url":"https://api.github.com/users/DominikAngerer/received_events","type":"User","site_admin":false},"body":"1. Changed syntax-highlighting for HTML document to HTML\r\n2. Added folder Java\r\n3. Added Number Formatting because that bugs a lot people.","created_at":"2015-01-27T17:57:25Z","updated_at":"2015-01-29T21:56:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"82dcb38825d03eade44d2ed7971d3b8203b236ef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thoughtbot/til/pulls/36/commits","review_comments_url":"https://api.github.com/repos/thoughtbot/til/pulls/36/comments","review_comment_url":"https://api.github.com/repos/thoughtbot/til/pulls/comments/{number}","comments_url":"https://api.github.com/repos/thoughtbot/til/issues/36/comments","statuses_url":"https://api.github.com/repos/thoughtbot/til/statuses/3345c124100e3ee2d61941ceb2567f63f75d2e02","head":{"label":"DominikAngerer:master","ref":"master","sha":"3345c124100e3ee2d61941ceb2567f63f75d2e02","user":{"login":"DominikAngerer","id":7952803,"avatar_url":"https://avatars.githubusercontent.com/u/7952803?v=3","gravatar_id":"","url":"https://api.github.com/users/DominikAngerer","html_url":"https://github.com/DominikAngerer","followers_url":"https://api.github.com/users/DominikAngerer/followers","following_url":"https://api.github.com/users/DominikAngerer/following{/other_user}","gists_url":"https://api.github.com/users/DominikAngerer/gists{/gist_id}","starred_url":"https://api.github.com/users/DominikAngerer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominikAngerer/subscriptions","organizations_url":"https://api.github.com/users/DominikAngerer/orgs","repos_url":"https://api.github.com/users/DominikAngerer/repos","events_url":"https://api.github.com/users/DominikAngerer/events{/privacy}","received_events_url":"https://api.github.com/users/DominikAngerer/received_events","type":"User","site_admin":false},"repo":{"id":29926721,"name":"til","full_name":"DominikAngerer/til","owner":{"login":"DominikAngerer","id":7952803,"avatar_url":"https://avatars.githubusercontent.com/u/7952803?v=3","gravatar_id":"","url":"https://api.github.com/users/DominikAngerer","html_url":"https://github.com/DominikAngerer","followers_url":"https://api.github.com/users/DominikAngerer/followers","following_url":"https://api.github.com/users/DominikAngerer/following{/other_user}","gists_url":"https://api.github.com/users/DominikAngerer/gists{/gist_id}","starred_url":"https://api.github.com/users/DominikAngerer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominikAngerer/subscriptions","organizations_url":"https://api.github.com/users/DominikAngerer/orgs","repos_url":"https://api.github.com/users/DominikAngerer/repos","events_url":"https://api.github.com/users/DominikAngerer/events{/privacy}","received_events_url":"https://api.github.com/users/DominikAngerer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DominikAngerer/til","description":"Today I Learned","fork":true,"url":"https://api.github.com/repos/DominikAngerer/til","forks_url":"https://api.github.com/repos/DominikAngerer/til/forks","keys_url":"https://api.github.com/repos/DominikAngerer/til/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DominikAngerer/til/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DominikAngerer/til/teams","hooks_url":"https://api.github.com/repos/DominikAngerer/til/hooks","issue_events_url":"https://api.github.com/repos/DominikAngerer/til/issues/events{/number}","events_url":"https://api.github.com/repos/DominikAngerer/til/events","assignees_url":"https://api.github.com/repos/DominikAngerer/til/assignees{/user}","branches_url":"https://api.github.com/repos/DominikAngerer/til/branches{/branch}","tags_url":"https://api.github.com/repos/DominikAngerer/til/tags","blobs_url":"https://api.github.com/repos/DominikAngerer/til/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DominikAngerer/til/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DominikAngerer/til/git/refs{/sha}","trees_url":"https://api.github.com/repos/DominikAngerer/til/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DominikAngerer/til/statuses/{sha}","languages_url":"https://api.github.com/repos/DominikAngerer/til/languages","stargazers_url":"https://api.github.com/repos/DominikAngerer/til/stargazers","contributors_url":"https://api.github.com/repos/DominikAngerer/til/contributors","subscribers_url":"https://api.github.com/repos/DominikAngerer/til/subscribers","subscription_url":"https://api.github.com/repos/DominikAngerer/til/subscription","commits_url":"https://api.github.com/repos/DominikAngerer/til/commits{/sha}","git_commits_url":"https://api.github.com/repos/DominikAngerer/til/git/commits{/sha}","comments_url":"https://api.github.com/repos/DominikAngerer/til/comments{/number}","issue_comment_url":"https://api.github.com/repos/DominikAngerer/til/issues/comments/{number}","contents_url":"https://api.github.com/repos/DominikAngerer/til/contents/{+path}","compare_url":"https://api.github.com/repos/DominikAngerer/til/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DominikAngerer/til/merges","archive_url":"https://api.github.com/repos/DominikAngerer/til/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DominikAngerer/til/downloads","issues_url":"https://api.github.com/repos/DominikAngerer/til/issues{/number}","pulls_url":"https://api.github.com/repos/DominikAngerer/til/pulls{/number}","milestones_url":"https://api.github.com/repos/DominikAngerer/til/milestones{/number}","notifications_url":"https://api.github.com/repos/DominikAngerer/til/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DominikAngerer/til/labels{/name}","releases_url":"https://api.github.com/repos/DominikAngerer/til/releases{/id}","created_at":"2015-01-27T17:55:17Z","updated_at":"2015-01-27T18:14:02Z","pushed_at":"2015-01-29T21:51:16Z","git_url":"git://github.com/DominikAngerer/til.git","ssh_url":"git@github.com:DominikAngerer/til.git","clone_url":"https://github.com/DominikAngerer/til.git","svn_url":"https://github.com/DominikAngerer/til","homepage":null,"size":134,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"thoughtbot:master","ref":"master","sha":"2db110f0905fb080977a1c6bcd17cb1dd091dde1","user":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"repo":{"id":29370487,"name":"til","full_name":"thoughtbot/til","owner":{"login":"thoughtbot","id":6183,"avatar_url":"https://avatars.githubusercontent.com/u/6183?v=3","gravatar_id":"","url":"https://api.github.com/users/thoughtbot","html_url":"https://github.com/thoughtbot","followers_url":"https://api.github.com/users/thoughtbot/followers","following_url":"https://api.github.com/users/thoughtbot/following{/other_user}","gists_url":"https://api.github.com/users/thoughtbot/gists{/gist_id}","starred_url":"https://api.github.com/users/thoughtbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thoughtbot/subscriptions","organizations_url":"https://api.github.com/users/thoughtbot/orgs","repos_url":"https://api.github.com/users/thoughtbot/repos","events_url":"https://api.github.com/users/thoughtbot/events{/privacy}","received_events_url":"https://api.github.com/users/thoughtbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thoughtbot/til","description":"Today I Learned","fork":false,"url":"https://api.github.com/repos/thoughtbot/til","forks_url":"https://api.github.com/repos/thoughtbot/til/forks","keys_url":"https://api.github.com/repos/thoughtbot/til/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thoughtbot/til/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thoughtbot/til/teams","hooks_url":"https://api.github.com/repos/thoughtbot/til/hooks","issue_events_url":"https://api.github.com/repos/thoughtbot/til/issues/events{/number}","events_url":"https://api.github.com/repos/thoughtbot/til/events","assignees_url":"https://api.github.com/repos/thoughtbot/til/assignees{/user}","branches_url":"https://api.github.com/repos/thoughtbot/til/branches{/branch}","tags_url":"https://api.github.com/repos/thoughtbot/til/tags","blobs_url":"https://api.github.com/repos/thoughtbot/til/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thoughtbot/til/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thoughtbot/til/git/refs{/sha}","trees_url":"https://api.github.com/repos/thoughtbot/til/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thoughtbot/til/statuses/{sha}","languages_url":"https://api.github.com/repos/thoughtbot/til/languages","stargazers_url":"https://api.github.com/repos/thoughtbot/til/stargazers","contributors_url":"https://api.github.com/repos/thoughtbot/til/contributors","subscribers_url":"https://api.github.com/repos/thoughtbot/til/subscribers","subscription_url":"https://api.github.com/repos/thoughtbot/til/subscription","commits_url":"https://api.github.com/repos/thoughtbot/til/commits{/sha}","git_commits_url":"https://api.github.com/repos/thoughtbot/til/git/commits{/sha}","comments_url":"https://api.github.com/repos/thoughtbot/til/comments{/number}","issue_comment_url":"https://api.github.com/repos/thoughtbot/til/issues/comments/{number}","contents_url":"https://api.github.com/repos/thoughtbot/til/contents/{+path}","compare_url":"https://api.github.com/repos/thoughtbot/til/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thoughtbot/til/merges","archive_url":"https://api.github.com/repos/thoughtbot/til/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thoughtbot/til/downloads","issues_url":"https://api.github.com/repos/thoughtbot/til/issues{/number}","pulls_url":"https://api.github.com/repos/thoughtbot/til/pulls{/number}","milestones_url":"https://api.github.com/repos/thoughtbot/til/milestones{/number}","notifications_url":"https://api.github.com/repos/thoughtbot/til/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thoughtbot/til/labels{/name}","releases_url":"https://api.github.com/repos/thoughtbot/til/releases{/id}","created_at":"2015-01-16T22:21:28Z","updated_at":"2015-01-29T21:43:41Z","pushed_at":"2015-01-29T15:59:04Z","git_url":"git://github.com/thoughtbot/til.git","ssh_url":"git@github.com:thoughtbot/til.git","clone_url":"https://github.com/thoughtbot/til.git","svn_url":"https://github.com/thoughtbot/til","homepage":null,"size":1016,"stargazers_count":1988,"watchers_count":1988,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":12,"forks":80,"open_issues":12,"watchers":1988,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/36"},"html":{"href":"https://github.com/thoughtbot/til/pull/36"},"issue":{"href":"https://api.github.com/repos/thoughtbot/til/issues/36"},"comments":{"href":"https://api.github.com/repos/thoughtbot/til/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/thoughtbot/til/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/thoughtbot/til/statuses/3345c124100e3ee2d61941ceb2567f63f75d2e02"}}}}